| Index: filter/dscache/context.go
|
| diff --git a/filter/dscache/context.go b/filter/dscache/context.go
|
| index a9f10ba1de6fbf0955edf5800ce4f3842925c0e6..87477802d1b16865193911103de8c36ce683e4e8 100644
|
| --- a/filter/dscache/context.go
|
| +++ b/filter/dscache/context.go
|
| @@ -18,6 +18,10 @@ var dsTxnCacheKey key
|
|
|
| // FilterRDS installs a caching RawDatastore filter in the context.
|
| //
|
| +// It does nothing if IsGloballyEnabled returns false. That way it is possible
|
| +// to disable the cache in runtime (e.g. in case memcache service is having
|
| +// issues).
|
| +//
|
| // shardsForKey is a user-controllable function which calculates the number of
|
| // shards to use for a certain datastore key. The provided key will always be
|
| // valid and complete.
|
| @@ -32,7 +36,14 @@ func FilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context.Contex
|
| if !IsGloballyEnabled(c) {
|
| return c
|
| }
|
| + return AlwaysFilterRDS(c, shardsForKey)
|
| +}
|
|
|
| +// AlwaysFilterRDS installs a caching RawDatastore filter in the context.
|
| +//
|
| +// Unlike FilterRDS it doesn't check GlobalConfig via IsGloballyEnabled call,
|
| +// assuming caller already knows whether filter should be applied or not.
|
| +func AlwaysFilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context.Context {
|
| return ds.AddRawFilters(c, func(c context.Context, ds ds.RawInterface) ds.RawInterface {
|
| i := info.Get(c)
|
|
|
|
|