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

Unified Diff: impl/prod/memcache.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/memory/raw_datastore_data.go ('k') | service/datastore/properties.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/memcache.go
diff --git a/impl/prod/memcache.go b/impl/prod/memcache.go
index cc4a3d1824008de3623416f7e556257d06d3ecf9..eef34b968a6163664e3ba72b1660f4bbe1ec372a 100644
--- a/impl/prod/memcache.go
+++ b/impl/prod/memcache.go
@@ -52,11 +52,13 @@ func (i mcItem) SetExpiration(d time.Duration) mc.Item {
}
func (i mcItem) SetAll(other mc.Item) {
- o := other.(mcItem)
- *i.i = *o.i
- val := i.i.Value
- i.i.Value = make([]byte, len(val))
- copy(i.i.Value, val)
+ if other == nil {
+ i.i = &memcache.Item{Key: i.i.Key}
+ } else {
+ k := i.i.Key
+ *i.i = *other.(mcItem).i
+ i.i.Key = k
+ }
}
// mcR2FErr (MC real-to-fake w/ error) converts a *memcache.Item to a mc.Item,
« no previous file with comments | « impl/memory/raw_datastore_data.go ('k') | service/datastore/properties.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698