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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/in_memory_memcache.py
diff --git a/chrome/common/extensions/docs/server2/in_memory_memcache.py b/chrome/common/extensions/docs/server2/in_memory_memcache.py
new file mode 100644
index 0000000000000000000000000000000000000000..de1892d952329bf5aaa69d4ac983547e6316f8d3
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/in_memory_memcache.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.
+
+class InMemoryMemcache(object):
+ """A memcache that stores items in memory instead of using the memcache
+ module.
+ """
+ def __init__(self):
+ self._cache = {}
+
+ def Set(self, key, value, namespace, time=60):
+ if namespace not in self._cache:
+ self._cache[namespace] = {}
+ self._cache[namespace][key] = value
+
+ def Get(self, key, namespace):
+ if namespace not in self._cache:
+ return None
+ return self._cache[namespace].get(key, None)
+
+ def Delete(self, key, namespace):
+ if namespace in self._cache:
+ self._cache[namespace].pop(key)
« 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