refactor datasource caching

This commit is contained in:
Marcus Efraimsson
2018-10-30 09:31:56 +01:00
parent 1dc8b898bb
commit cfb061ddab
9 changed files with 109 additions and 55 deletions
+14
View File
@@ -0,0 +1,14 @@
package middleware
import (
m "github.com/grafana/grafana/pkg/models"
macaron "gopkg.in/macaron.v1"
)
const HeaderNameNoBackendCache = "X-Grafana-NoCache"
func HandleNoCacheHeader() macaron.Handler {
return func(ctx *m.ReqContext) {
ctx.SkipCache = ctx.Req.Header.Get(HeaderNameNoBackendCache) == "true"
}
}
+1
View File
@@ -29,6 +29,7 @@ func GetContextHandler() macaron.Handler {
Session: session.GetSession(),
IsSignedIn: false,
AllowAnonymous: false,
SkipCache: false,
Logger: log.New("context"),
}