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

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

Issue 10704252: Extensions Docs Server: Internal file system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up Created 8 years, 5 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 class InMemoryMemcache(object):
6 """A memcache that stores items in memory instead of using the memcache
7 module.
8 """
9 def __init__(self):
10 self._cache = {}
11
12 def Set(self, key, value, namespace, time=60):
13 if namespace not in self._cache:
14 self._cache[namespace] = {}
15 self._cache[namespace][key] = value
16
17 def Get(self, key, namespace):
18 if namespace not in self._cache:
19 return None
20 return self._cache[namespace].get(key, None)
21
22 def Delete(self, key, namespace):
23 if namespace in self._cache:
24 self._cache[namespace].pop(key)
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/future.py ('k') | chrome/common/extensions/docs/server2/intro_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698