Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3244)

Unified Diff: filter/dscache/globalconfig.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: appease errcheck Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « filter/dscache/dscache_test.go ('k') | filter/dscache/plan.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/dscache/globalconfig.go
diff --git a/filter/dscache/globalconfig.go b/filter/dscache/globalconfig.go
index 74212e50340207449f3b36b9dad4b47f0bc305d0..d3fa620a09d9a8cbc68765f145ab1da6032db024 100644
--- a/filter/dscache/globalconfig.go
+++ b/filter/dscache/globalconfig.go
@@ -15,6 +15,13 @@ import (
"golang.org/x/net/context"
)
+// GlobalConfig is the entity definition for dscache's global configuration.
+//
+// It's Enable field can be set to false to cause all dscache operations
+// (read and write) to cease in a given application.
+//
+// This should be manipulated in the GLOBAL (e.g. empty) namespace only. When
+// written there, it affects activity in all namespaces.
type GlobalConfig struct {
_id int64 `gae:"$id,1"`
_kind string `gae:"$kind,dscache"`
@@ -80,6 +87,10 @@ func IsGloballyEnabled(c context.Context) bool {
return globalEnabled
}
+// SetGlobalEnable is a convenience function for manipulating the GlobalConfig.
+//
+// It's meant to be called from admin handlers on your app to turn dscache
+// functionality on or off in emergencies.
func SetGlobalEnable(c context.Context, memcacheEnabled bool) error {
// always go to the default namespace
c, err := info.Get(c).Namespace("")
« no previous file with comments | « filter/dscache/dscache_test.go ('k') | filter/dscache/plan.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698