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
c5bc723a
Commit
c5bc723a
authored
Mar 20, 2019
by
Oleg Gaidarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct table names of sql storage for remotecache
parent
d1e48a07
Show 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 @
c5bc723a
...
...
@@ -101,7 +101,7 @@ func (dc *databaseCache) Set(key string, value interface{}, expire time.Duration
// insert or update depending on if item already exist
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
)
}
else
{
sql
:=
`INSERT INTO cache_data (cache_key,data,created_at,expires) VALUES(?,?,?,?)`
...
...
pkg/infra/remotecache/database_storage_test.go
View file @
c5bc723a
...
...
@@ -5,7 +5,6 @@ import (
"time"
"github.com/bmizerany/assert"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/services/sqlstore"
)
...
...
@@ -54,3 +53,20 @@ func TestDatabaseStorageGarbageCollection(t *testing.T) {
_
,
err
=
db
.
Get
(
"key5"
)
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