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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from appengine_wrappers import memcache
6 from object_store import ObjectStore, CACHE_TIMEOUT
7
8 class _AsyncMemcacheGetFuture(object):
9 def __init__(self, rpc):
10 self._rpc = rpc
11
12 def Get(self):
13 return self._rpc.get_result()
14
15 class MemcacheObjectStore(ObjectStore):
16 def SetMulti(self, mapping, namespace, time=CACHE_TIMEOUT):
17 memcache.Client().set_multi_async(mapping, namespace=namespace, time=time)
18
19 def GetMulti(self, keys, namespace, time=CACHE_TIMEOUT):
20 rpc = memcache.Client().get_multi_async(keys, namespace=namespace)
21 return _AsyncMemcacheGetFuture(rpc)
22
23 def Delete(self, key, namespace):
24 memcache.delete(key, namespace=namespace)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698