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

Unified Diff: chrome/common/extensions/docs/server2/memcache_object_store.py

Issue 10829348: Extensions Docs Server: Large performance increase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: chrome/common/extensions/docs/server2/memcache_object_store.py
diff --git a/chrome/common/extensions/docs/server2/memcache_object_store.py b/chrome/common/extensions/docs/server2/memcache_object_store.py
new file mode 100644
index 0000000000000000000000000000000000000000..71751b8d772387cdf5262e3f914ff8de53833882
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/memcache_object_store.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from appengine_wrappers import memcache
+from object_store import ObjectStore, CACHE_TIMEOUT
+
+class _AsyncMemcacheGetFuture(object):
+ def __init__(self, rpc):
+ self._rpc = rpc
+
+ def Get(self):
+ return self._rpc.get_result()
+
+class MemcacheObjectStore(ObjectStore):
+ def SetMulti(self, mapping, namespace, time=CACHE_TIMEOUT):
+ memcache.Client().set_multi_async(mapping, namespace=namespace, time=time)
+
+ def GetMulti(self, keys, namespace, time=CACHE_TIMEOUT):
+ rpc = memcache.Client().get_multi_async(keys, namespace=namespace)
+ return _AsyncMemcacheGetFuture(rpc)
+
+ def Delete(self, key, namespace):
+ memcache.delete(key, namespace=namespace)

Powered by Google App Engine
This is Rietveld 408576698