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
6809d2bb
Unverified
Commit
6809d2bb
authored
Jun 13, 2019
by
Carl Bergquist
Committed by
GitHub
Jun 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codestyle: moves cache to infra (#17519)
parent
df917663
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
pkg/api/http_server.go
+2
-2
pkg/cmd/grafana-server/server.go
+1
-1
pkg/infra/localcache/cache.go
+3
-1
pkg/services/datasources/cache.go
+3
-3
pkg/services/sqlstore/sqlstore.go
+5
-5
No files found.
pkg/api/http_server.go
View file @
6809d2bb
...
...
@@ -16,13 +16,13 @@ import (
httpstatic
"github.com/grafana/grafana/pkg/api/static"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/remotecache"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/services/cache"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/hooks"
"github.com/grafana/grafana/pkg/services/quota"
...
...
@@ -60,7 +60,7 @@ type HTTPServer struct {
RenderService
rendering
.
Service
`inject:""`
Cfg
*
setting
.
Cfg
`inject:""`
HooksService
*
hooks
.
HooksService
`inject:""`
CacheService
*
cache
.
CacheService
`inject:""`
CacheService
*
localcache
.
CacheService
`inject:""`
DatasourceCache
datasources
.
CacheService
`inject:""`
AuthTokenService
models
.
UserTokenService
`inject:""`
QuotaService
*
quota
.
QuotaService
`inject:""`
...
...
pkg/cmd/grafana-server/server.go
View file @
6809d2bb
...
...
@@ -12,6 +12,7 @@ import (
"time"
"github.com/facebookgo/inject"
"github.com/patrickmn/go-cache"
"golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/api"
...
...
@@ -31,7 +32,6 @@ import (
"github.com/grafana/grafana/pkg/registry"
_
"github.com/grafana/grafana/pkg/services/alerting"
_
"github.com/grafana/grafana/pkg/services/auth"
"github.com/grafana/grafana/pkg/services/cache"
_
"github.com/grafana/grafana/pkg/services/cleanup"
_
"github.com/grafana/grafana/pkg/services/notifications"
_
"github.com/grafana/grafana/pkg/services/provisioning"
...
...
pkg/
services/
cache/cache.go
→
pkg/
infra/local
cache/cache.go
View file @
6809d2bb
package
cache
package
local
cache
import
(
"time"
...
...
@@ -6,10 +6,12 @@ import (
gocache
"github.com/patrickmn/go-cache"
)
// CacheService cache any object in memory on the local instance.
type
CacheService
struct
{
*
gocache
.
Cache
}
// New returns a new CacheService
func
New
(
defaultExpiration
,
cleanupInterval
time
.
Duration
)
*
CacheService
{
return
&
CacheService
{
Cache
:
gocache
.
New
(
defaultExpiration
,
cleanupInterval
),
...
...
pkg/services/datasources/cache.go
View file @
6809d2bb
...
...
@@ -5,9 +5,9 @@ import (
"time"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/localcache"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/services/cache"
)
type
CacheService
interface
{
...
...
@@ -15,8 +15,8 @@ type CacheService interface {
}
type
CacheServiceImpl
struct
{
Bus
bus
.
Bus
`inject:""`
CacheService
*
cache
.
CacheService
`inject:""`
Bus
bus
.
Bus
`inject:""`
CacheService
*
local
cache
.
CacheService
`inject:""`
}
func
init
()
{
...
...
pkg/services/sqlstore/sqlstore.go
View file @
6809d2bb
...
...
@@ -13,11 +13,11 @@ import (
"github.com/go-sql-driver/mysql"
"github.com/go-xorm/xorm"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/infra/log"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/services/annotations"
"github.com/grafana/grafana/pkg/services/cache"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
...
...
@@ -50,9 +50,9 @@ func init() {
}
type
SqlStore
struct
{
Cfg
*
setting
.
Cfg
`inject:""`
Bus
bus
.
Bus
`inject:""`
CacheService
*
cache
.
CacheService
`inject:""`
Cfg
*
setting
.
Cfg
`inject:""`
Bus
bus
.
Bus
`inject:""`
CacheService
*
local
cache
.
CacheService
`inject:""`
dbCfg
DatabaseConfig
engine
*
xorm
.
Engine
...
...
@@ -296,7 +296,7 @@ func InitTestDB(t ITestDB) *SqlStore {
sqlstore
:=
&
SqlStore
{}
sqlstore
.
skipEnsureAdmin
=
true
sqlstore
.
Bus
=
bus
.
New
()
sqlstore
.
CacheService
=
cache
.
New
(
5
*
time
.
Minute
,
10
*
time
.
Minute
)
sqlstore
.
CacheService
=
local
cache
.
New
(
5
*
time
.
Minute
,
10
*
time
.
Minute
)
dbType
:=
migrator
.
SQLITE
...
...
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