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

Side by Side Diff: appengine/findit/gae_libs/caches.py

Issue 2538373003: [Culprit-Finder] Merge lib/ to libs/. (Closed)
Patch Set: . Created 4 years 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import cStringIO 5 import cStringIO
6 import pickle 6 import pickle
7 import zlib 7 import zlib
8 8
9 from google.appengine.api import memcache 9 from google.appengine.api import memcache
10 10
11 from lib.cache import Cache 11 from libs.cache import Cache
12 12
13 13
14 class PickledMemCache(Cache): 14 class PickledMemCache(Cache):
15 """A memcache-backed implementation of the interface Cache. 15 """A memcache-backed implementation of the interface Cache.
16 16
17 The data to be cached should be pickleable. 17 The data to be cached should be pickleable.
18 Limitation: size of the pickled data and key should be <= 1MB. 18 Limitation: size of the pickled data and key should be <= 1MB.
19 """ 19 """
20 def Get(self, key): 20 def Get(self, key):
21 return memcache.get(key) 21 return memcache.get(key)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 all_data[sub_key] = compressed_data[index : index + self.CHUNK_SIZE] 66 all_data[sub_key] = compressed_data[index : index + self.CHUNK_SIZE]
67 num += 1 67 num += 1
68 68
69 all_data[key] = _CachedItemMetaData(num) 69 all_data[key] = _CachedItemMetaData(num)
70 else: 70 else:
71 all_data[key] = compressed_data 71 all_data[key] = compressed_data
72 72
73 keys_not_set = memcache.set_multi(all_data, time=expire_time) 73 keys_not_set = memcache.set_multi(all_data, time=expire_time)
74 return len(keys_not_set) == 0 74 return len(keys_not_set) == 0
75 75
OLDNEW
« no previous file with comments | « appengine/findit/findit_api.py ('k') | appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698