OLD | NEW |
---|---|
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 self._memcache.Set(item, | 60 self._memcache.Set(item, |
61 (value, version), | 61 (value, version), |
62 memcache.MEMCACHE_FILE_SYSTEM_READ) | 62 memcache.MEMCACHE_FILE_SYSTEM_READ, |
63 time=0) | |
not at google - send to devlin
2012/08/14 22:19:47
what was it before?
but cool, add a commet like "
| |
63 result[item] = value | 64 result[item] = value |
64 return Future(value=result) | 65 return Future(value=result) |
OLD | NEW |