Commit 6ca86b7f authored by Yoshinori Okuji's avatar Yoshinori Okuji

Optimize the cache retrieval when a quick cache is available.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29676 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7c588c78
...@@ -68,6 +68,7 @@ class CacheFactory: ...@@ -68,6 +68,7 @@ class CacheFactory:
## separete local and shared cache plugins ## separete local and shared cache plugins
self.quick_cache = self.cache_plugins[0] self.quick_cache = self.cache_plugins[0]
self._quick_cache_get = self.quick_cache.get
try: try:
self.shared_caches = self.cache_plugins[1:] self.shared_caches = self.cache_plugins[1:]
except IndexError: except IndexError:
...@@ -92,8 +93,7 @@ class CacheFactory: ...@@ -92,8 +93,7 @@ class CacheFactory:
self.expire(now) self.expire(now)
try: try:
quick_cached = self.quick_cache.get(cache_id, scope) return self._quick_cache_get(cache_id, scope).getValue()
return quick_cached.getValue()
except KeyError: except KeyError:
## not in local, check if it's in shared ## not in local, check if it's in shared
for shared_cache in self.shared_caches: for shared_cache in self.shared_caches:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment