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

Unified Diff: appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py

Issue 2557553002: [Culprit-Finder] Seperate gae related part in cache_decorator and gitile repository to gae_libs/ (Closed)
Patch Set: Fix nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/gae_libs/gitiles/__init__.py ('k') | appengine/findit/gae_libs/test/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py
diff --git a/appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py b/appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py
new file mode 100644
index 0000000000000000000000000000000000000000..73b7ebb1522e54cd92aceed9ce5ceba99aaa0e40
--- /dev/null
+++ b/appengine/findit/gae_libs/gitiles/cached_gitiles_repository.py
@@ -0,0 +1,25 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from gae_libs.caches import CompressedMemCache
+from gae_libs.caches import PickledMemCache
+
+from lib.cache_decorator import Cached
+from lib.gitiles.gitiles_repository import GitilesRepository
+
+CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60
+
+
+class CachedGitilesRepository(GitilesRepository):
+
+ @Cached(namespace='Gitiles-json-view', expire_time=CACHE_EXPIRE_TIME_SECONDS,
+ cache=CompressedMemCache())
+ def _SendRequestForJsonResponse(self, url, params=None): # pragma: no cover
+ return super(CachedGitilesRepository, self)._SendRequestForJsonResponse(
+ url, params=params)
+
+ @Cached(namespace='Gitiles-text-view', expire_time=CACHE_EXPIRE_TIME_SECONDS,
+ cache=PickledMemCache())
+ def _SendRequestForTextResponse(self, url): # pragma: no cover
+ return super(CachedGitilesRepository, self)._SendRequestForTextResponse(url)
« no previous file with comments | « appengine/findit/gae_libs/gitiles/__init__.py ('k') | appengine/findit/gae_libs/test/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698