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

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

Issue 10828042: Extensions Docs Server: Integration testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for CQ 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 class InMemoryMemcache(object): 5 class InMemoryMemcache(object):
6 """A memcache that stores items in memory instead of using the memcache 6 """A memcache that stores items in memory instead of using the memcache
7 module. 7 module.
8 """ 8 """
9 def __init__(self): 9 def __init__(self):
10 self._cache = {} 10 self._cache = {}
11 11
12 def Set(self, key, value, namespace, time=60): 12 def set(self, key, value, namespace, time=60):
not at google - send to devlin 2012/07/31 06:04:36 this has different interface to AppEngineMemcache
13 if namespace not in self._cache: 13 if namespace not in self._cache:
14 self._cache[namespace] = {} 14 self._cache[namespace] = {}
15 self._cache[namespace][key] = value 15 self._cache[namespace][key] = value
16 16
17 def Get(self, key, namespace): 17 def get(self, key, namespace):
18 if namespace not in self._cache: 18 if namespace not in self._cache:
19 return None 19 return None
20 return self._cache[namespace].get(key, None) 20 return self._cache[namespace].get(key, None)
21 21
22 def Delete(self, key, namespace): 22 def delete(self, key, namespace):
23 if namespace in self._cache: 23 if namespace in self._cache:
24 self._cache[namespace].pop(key) 24 self._cache[namespace].pop(key)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698