예제 #1
0
func invalidateCache(req *wcg.Request, kind *Kind, cache *memcache.Driver, keys ...string) {
	if err := cache.DeleteMulti(keys); memcache.IsMemcacheError(err) {
		req.Logger.Warnf("[%s] Could not delete from cache (keys=%v): %v", kind, keys, err)
	} else {
		req.Logger.Debugf("[%s] Invalidated entities cache (keys=%v)", kind, keys)
	}
}
예제 #2
0
func createCache(req *wcg.Request, kind *Kind, cache *memcache.Driver, ent interface{}, keys ...string) {
	if err := cache.SetMulti(keys, ent); err != nil {
		req.Logger.Warnf("[%s] Could not create into cache (keys=%v): %v", kind, err, keys)
	} else {
		req.Logger.Debugf("[%s] Entities created into cache (keys=%v)", kind, keys)
	}
}