Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
30f0c350
Unverified
Commit
30f0c350
authored
Mar 20, 2019
by
Oleg Gaidarenko
Committed by
GitHub
Mar 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16104 from markelog/remotecache-small-fix
Correct table names of sql storage for remotecache
parents
e5d84f8c
c5bc723a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
pkg/infra/remotecache/database_storage.go
+1
-1
pkg/infra/remotecache/database_storage_test.go
+17
-1
No files found.
pkg/infra/remotecache/database_storage.go
View file @
30f0c350
...
@@ -101,7 +101,7 @@ func (dc *databaseCache) Set(key string, value interface{}, expire time.Duration
...
@@ -101,7 +101,7 @@ func (dc *databaseCache) Set(key string, value interface{}, expire time.Duration
// insert or update depending on if item already exist
// insert or update depending on if item already exist
if
has
{
if
has
{
sql
:=
`UPDATE cache_data SET data=?, created
=?, expire=? WHERE cache_key='?'
`
sql
:=
`UPDATE cache_data SET data=?, created
_at=?, expires=? WHERE cache_key=?
`
_
,
err
=
session
.
Exec
(
sql
,
data
,
getTime
()
.
Unix
(),
expiresInSeconds
,
key
)
_
,
err
=
session
.
Exec
(
sql
,
data
,
getTime
()
.
Unix
(),
expiresInSeconds
,
key
)
}
else
{
}
else
{
sql
:=
`INSERT INTO cache_data (cache_key,data,created_at,expires) VALUES(?,?,?,?)`
sql
:=
`INSERT INTO cache_data (cache_key,data,created_at,expires) VALUES(?,?,?,?)`
...
...
pkg/infra/remotecache/database_storage_test.go
View file @
30f0c350
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"time"
"time"
"github.com/bmizerany/assert"
"github.com/bmizerany/assert"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore"
)
)
...
@@ -54,3 +53,20 @@ func TestDatabaseStorageGarbageCollection(t *testing.T) {
...
@@ -54,3 +53,20 @@ func TestDatabaseStorageGarbageCollection(t *testing.T) {
_
,
err
=
db
.
Get
(
"key5"
)
_
,
err
=
db
.
Get
(
"key5"
)
assert
.
Equal
(
t
,
err
,
nil
)
assert
.
Equal
(
t
,
err
,
nil
)
}
}
func
TestSecondSet
(
t
*
testing
.
T
)
{
var
err
error
sqlstore
:=
sqlstore
.
InitTestDB
(
t
)
db
:=
&
databaseCache
{
SQLStore
:
sqlstore
,
log
:
log
.
New
(
"remotecache.database"
),
}
obj
:=
&
CacheableStruct
{
String
:
"hey!"
}
err
=
db
.
Set
(
"killa-gorilla"
,
obj
,
0
)
err
=
db
.
Set
(
"killa-gorilla"
,
obj
,
0
)
assert
.
Equal
(
t
,
err
,
nil
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment