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

Side by Side Diff: chrome/common/extensions/docs/server2/appengine_memcache.py

Issue 10825067: Extensions Docs Server: Apps samples page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blobstore 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
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from appengine_wrappers import memcache 5 from appengine_wrappers import memcache
6 6
7 MEMCACHE_BLOBSTORE = 'MemcacheBlobstore'
7 MEMCACHE_FILE_SYSTEM_READ = 'MemcacheFileSystem.Get' 8 MEMCACHE_FILE_SYSTEM_READ = 'MemcacheFileSystem.Get'
8 MEMCACHE_FILE_SYSTEM_STAT = 'MemcacheFileSystem.Stat' 9 MEMCACHE_FILE_SYSTEM_STAT = 'MemcacheFileSystem.Stat'
10 MEMCACHE_GITHUB_STAT = 'MemcacheGithub.Stat'
9 MEMCACHE_BRANCH_UTILITY = 'BranchUtility' 11 MEMCACHE_BRANCH_UTILITY = 'BranchUtility'
10 12
11 class AppEngineMemcache(object): 13 class AppEngineMemcache(object):
12 """A wrapper around the standard App Engine memcache that enforces namespace 14 """A wrapper around the standard App Engine memcache that enforces namespace
13 use. Uses a branch to make sure there are no key collisions if separate 15 use. Uses a branch to make sure there are no key collisions if separate
14 branches cache the same file. 16 branches cache the same file.
15 """ 17 """
16 def __init__(self, branch): 18 def __init__(self, branch):
17 self._branch = branch 19 self._branch = branch
18 20
19 def Set(self, key, value, namespace, time=60): 21 def Set(self, key, value, namespace, time=60):
20 return memcache.set(key, 22 return memcache.set(key,
21 value, 23 value,
22 namespace=self._branch + '.' + namespace, 24 namespace=self._branch + '.' + namespace,
23 time=time) 25 time=time)
24 26
25 def Get(self, key, namespace): 27 def Get(self, key, namespace):
26 return memcache.get(key, namespace=self._branch + '.' + namespace) 28 return memcache.get(key, namespace=self._branch + '.' + namespace)
27 29
28 def Delete(self, key, namespace): 30 def Delete(self, key, namespace):
29 return memcache.delete(key, namespace=self._branch + '.' + namespace) 31 return memcache.delete(key, namespace=self._branch + '.' + namespace)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698