| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from gae_libs.caches import CompressedMemCache |
| 6 from gae_libs.caches import PickledMemCache |
| 7 |
| 8 from lib.cache_decorator import Cached |
| 9 from lib.gitiles.gitiles_repository import GitilesRepository |
| 10 |
| 11 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 |
| 12 |
| 13 |
| 14 class CachedGitilesRepository(GitilesRepository): |
| 15 |
| 16 @Cached(namespace='Gitiles-json-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, |
| 17 cache=CompressedMemCache()) |
| 18 def _SendRequestForJsonResponse(self, url, params=None): # pragma: no cover |
| 19 return super(CachedGitilesRepository, self)._SendRequestForJsonResponse( |
| 20 url, params=params) |
| 21 |
| 22 @Cached(namespace='Gitiles-text-view', expire_time=CACHE_EXPIRE_TIME_SECONDS, |
| 23 cache=PickledMemCache()) |
| 24 def _SendRequestForTextResponse(self, url): # pragma: no cover |
| 25 return super(CachedGitilesRepository, self)._SendRequestForTextResponse(url) |
| OLD | NEW |