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

Unified Diff: service/datastore/properties.go

Issue 1269113005: A transparent cache for datastore, backed by memcache. (Closed) Base URL: https://github.com/luci/gae.git@add_meta
Patch Set: fix comments Created 5 years, 4 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 | « impl/prod/memcache.go ('k') | service/datastore/properties_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/properties.go
diff --git a/service/datastore/properties.go b/service/datastore/properties.go
index 11f62dc2939334b7581ee453aa541365b1c518cd..8ce5970def31e1939b3f69638c85bfca264e00de 100644
--- a/service/datastore/properties.go
+++ b/service/datastore/properties.go
@@ -431,7 +431,7 @@ func (pm PropertyMap) Save(withMeta bool) (PropertyMap, error) {
}
ret := make(PropertyMap, len(pm))
for k, v := range pm {
- if withMeta || len(k) == 0 || k[0] != '$' {
+ if withMeta || !isMetaKey(k) {
ret[k] = append(ret[k], v...)
}
}
@@ -472,6 +472,12 @@ func (pm PropertyMap) Problem() error {
return nil
}
+func isMetaKey(k string) bool {
+ // empty counts as a metakey since it's not a valid data key, but it's
+ // not really a valid metakey either.
+ return k == "" || k[0] == '$'
+}
+
// GetMetaDefaultImpl is the implementation of PropertyLoadSaver.GetMetaDefault.
//
// It takes the normal GetMeta function, the key and the default, and returns
« no previous file with comments | « impl/prod/memcache.go ('k') | service/datastore/properties_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698