Commit 99d3f640 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use try...get() instead of has_key() and get() for better performance.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29680 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b0b9773e
...@@ -97,8 +97,11 @@ class CacheFactory: ...@@ -97,8 +97,11 @@ class CacheFactory:
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:
if shared_cache.has_key(cache_id, scope): try:
cache_entry = shared_cache.get(cache_id, scope) cache_entry = shared_cache.get(cache_id, scope)
except KeyError:
pass
else:
value = cache_entry.getValue() value = cache_entry.getValue()
## update local cache ## update local cache
self.quick_cache.set(cache_id, scope, value, self.quick_cache.set(cache_id, scope, value,
......
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