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

Unified Diff: chrome/common/extensions/docs/server2/memcache_file_system.py

Issue 10828235: Extensions Docs Server: Efficient MemcacheFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/memcache_file_system.py
diff --git a/chrome/common/extensions/docs/server2/memcache_file_system.py b/chrome/common/extensions/docs/server2/memcache_file_system.py
index 5ac407237cabd5055aeee07a1def863a80b4d147..e46f8c91fa6fc50ded9c0de8053f46820b7d9275 100644
--- a/chrome/common/extensions/docs/server2/memcache_file_system.py
+++ b/chrome/common/extensions/docs/server2/memcache_file_system.py
@@ -23,8 +23,13 @@ class MemcacheFileSystem(FileSystem):
self._memcache.Set(path,
stat_info.version,
memcache.MEMCACHE_FILE_SYSTEM_STAT)
+ if stat_info.child_versions is not None:
+ for child_path, child_version in stat_info.child_versions.iteritems():
+ self._memcache.Set(path.rsplit('/', 1)[0] + '/' + child_path,
+ child_version,
+ memcache.MEMCACHE_FILE_SYSTEM_STAT)
else:
- stat_info = self.StatInfo(version)
+ stat_info = self.StatInfo(version, None)
return stat_info
def Read(self, paths, binary=False):
@@ -45,12 +50,13 @@ class MemcacheFileSystem(FileSystem):
uncached.append(path)
continue
result[path] = data
- new_items = self._file_system.Read(uncached, binary=binary).Get()
- for item in new_items:
- version = self.Stat(item).version
- value = new_items[item]
- self._memcache.Set(item,
- (value, version),
- memcache.MEMCACHE_FILE_SYSTEM_READ)
- result[item] = value
+ if uncached:
+ new_items = self._file_system.Read(uncached, binary=binary).Get()
not at google - send to devlin 2012/08/13 23:02:14 Add a TODO here, TODO(cduvall): if there are unca
cduvall 2012/08/14 18:15:00 Done.
+ for item in new_items:
+ version = self.Stat(item).version
+ value = new_items[item]
+ self._memcache.Set(item,
+ (value, version),
+ memcache.MEMCACHE_FILE_SYSTEM_READ)
+ result[item] = value
return Future(value=result)

Powered by Google App Engine
This is Rietveld 408576698