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

Side by Side Diff: appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py

Issue 2644543006: [Culprit-Finder] Add generator cache decorator. (Closed)
Patch Set: Rebase and fix nits. Created 3 years, 11 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
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 from gae_libs.caches import CompressedMemCache 5 from gae_libs.caches import CompressedMemCache
6 from gae_libs.caches import PickledMemCache 6 from gae_libs.caches import PickledMemCache
7 7
8 from libs.cache_decorator import Cached 8 from libs.cache_decorator import Cached
9 from libs.gitiles.gitiles_repository import GitilesRepository 9 from libs.gitiles.gitiles_repository import GitilesRepository
10 10
11 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 11 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60
12 12
13 13
14 class CachedGitilesRepository(GitilesRepository): 14 class CachedGitilesRepository(GitilesRepository):
15 15
16 @Cached(namespace='Gitiles-json-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, 16 @Cached(CompressedMemCache(), namespace='Gitiles-json-view',
17 cache=CompressedMemCache()) 17 expire_time=CACHE_EXPIRE_TIME_SECONDS)
18 def _SendRequestForJsonResponse(self, url, params=None): # pragma: no cover 18 def _SendRequestForJsonResponse(self, url, params=None): # pragma: no cover
19 return super(CachedGitilesRepository, self)._SendRequestForJsonResponse( 19 return super(CachedGitilesRepository, self)._SendRequestForJsonResponse(
20 url, params=params) 20 url, params=params)
21 21
22 @Cached(namespace='Gitiles-text-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, 22 @Cached(PickledMemCache(), namespace='Gitiles-text-view',
23 cache=PickledMemCache()) 23 expire_time=CACHE_EXPIRE_TIME_SECONDS)
24 def _SendRequestForTextResponse(self, url): # pragma: no cover 24 def _SendRequestForTextResponse(self, url): # pragma: no cover
25 return super(CachedGitilesRepository, self)._SendRequestForTextResponse(url) 25 return super(CachedGitilesRepository, self)._SendRequestForTextResponse(url)
OLDNEW
« no previous file with comments | « appengine/findit/crash/loglinear/changelist_features/min_distance.py ('k') | appengine/findit/libs/cache_decorator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698