Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
|
wrengr
2016/12/06 21:52:56
year should be 2016
Sharu Jiang
2016/12/06 23:58:17
Done.
| |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import functools | |
|
wrengr
2016/12/06 21:52:56
I don't think this import is used
Sharu Jiang
2016/12/06 23:58:16
Done.
| |
| 6 | |
| 7 from gae_libs.caches import CompressedMemCache | |
| 8 from gae_libs.caches import PickledMemCache | |
| 9 | |
| 10 from lib.cache_decorator import Cached | |
| 11 from lib.gitiles.gitiles_repository import GitilesRepository | |
| 12 | |
| 13 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 | |
| 14 | |
| 15 | |
| 16 class CachedGitilesRepository(GitilesRepository): | |
| 17 | |
| 18 @Cached(namespace='Gitiles-json-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, | |
| 19 cache=CompressedMemCache()) | |
| 20 def _SendRequestForJsonResponse(self, url, params=None): # pragma: no cover | |
| 21 return super(CachedGitilesRepository, self)._SendRequestForJsonResponse( | |
| 22 url, params=params) | |
| 23 | |
| 24 @Cached(namespace='Gitiles-text-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, | |
| 25 cache=PickledMemCache()) | |
| 26 def _SendRequestForTextResponse(self, url): # pragma: no cover | |
| 27 return super(CachedGitilesRepository, self)._SendRequestForTextResponse(url) | |
| OLD | NEW |