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

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

Issue 10836253: Extensions Docs Server: memcache_file_system fix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 file_system import FileSystem 5 from file_system import FileSystem
6 from future import Future 6 from future import Future
7 import appengine_memcache as memcache 7 import appengine_memcache as memcache
8 8
9 class MemcacheFileSystem(FileSystem): 9 class MemcacheFileSystem(FileSystem):
10 """FileSystem implementation which memcaches the results of Read. 10 """FileSystem implementation which memcaches the results of Read.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 uncached.append(path) 50 uncached.append(path)
51 continue 51 continue
52 result[path] = data 52 result[path] = data
53 if uncached: 53 if uncached:
54 # TODO(cduvall): if there are uncached items we should return an 54 # TODO(cduvall): if there are uncached items we should return an
55 # asynchronous future. http://crbug.com/142013 55 # asynchronous future. http://crbug.com/142013
56 new_items = self._file_system.Read(uncached, binary=binary).Get() 56 new_items = self._file_system.Read(uncached, binary=binary).Get()
57 for item in new_items: 57 for item in new_items:
58 version = self.Stat(item).version 58 version = self.Stat(item).version
59 value = new_items[item] 59 value = new_items[item]
60 # Cache this file forever.
60 self._memcache.Set(item, 61 self._memcache.Set(item,
61 (value, version), 62 (value, version),
62 memcache.MEMCACHE_FILE_SYSTEM_READ) 63 memcache.MEMCACHE_FILE_SYSTEM_READ,
64 time=0)
63 result[item] = value 65 result[item] = value
64 return Future(value=result) 66 return Future(value=result)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698