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

Unified Diff: chrome/common/extensions/docs/server2/branch_utility.py

Issue 10829348: Extensions Docs Server: Large performance increase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/branch_utility.py
diff --git a/chrome/common/extensions/docs/server2/branch_utility.py b/chrome/common/extensions/docs/server2/branch_utility.py
index 187382cb82ade3df7a3c57354b41e279a6842a90..71dea6cca9e431559d60490dd1de16106f828b7a 100644
--- a/chrome/common/extensions/docs/server2/branch_utility.py
+++ b/chrome/common/extensions/docs/server2/branch_utility.py
@@ -4,15 +4,15 @@
import json
-import appengine_memcache as memcache
+import object_store
import operator
class BranchUtility(object):
- def __init__(self, base_path, default_branch, fetcher, memcache):
+ def __init__(self, base_path, default_branch, fetcher, object_store):
self._base_path = base_path
self._default_branch = default_branch
self._fetcher = fetcher
- self._memcache = memcache
+ self._object_store = object_store
def GetAllBranchNumbers(self):
return [self.GetBranchNumberForChannelName(branch)
@@ -39,8 +39,9 @@ class BranchUtility(object):
if channel_name in ['trunk', 'local']:
return channel_name
- branch_number = self._memcache.Get(channel_name + '.' + self._base_path,
- memcache.MEMCACHE_BRANCH_UTILITY)
+ branch_number = self._object_store.Get(channel_name + '.' + self._base_path,
+ object_store.BRANCH_UTILITY,
+ time=86400).Get()
if branch_number is not None:
return branch_number
@@ -63,9 +64,9 @@ class BranchUtility(object):
operator.itemgetter(1),
True)
# Cache for 24 hours.
- self._memcache.Set(channel_name + '.' + self._base_path,
- sorted_branches[0][0],
- memcache.MEMCACHE_BRANCH_UTILITY,
- time=86400)
+ self._object_store.Set(channel_name + '.' + self._base_path,
+ sorted_branches[0][0],
+ object_store.BRANCH_UTILITY,
+ time=86400)
return sorted_branches[0][0]

Powered by Google App Engine
This is Rietveld 408576698