[Erp5-report] r29680 - /erp5/trunk/products/ERP5Type/Cache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 15 16:26:28 CEST 2009
Author: kazuhiko
Date: Thu Oct 15 16:26:25 2009
New Revision: 29680
URL: http://svn.erp5.org?rev=29680&view=rev
Log:
use try...get() instead of has_key() and get() for better performance.
Modified:
erp5/trunk/products/ERP5Type/Cache.py
Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=29680&r1=29679&r2=29680&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Cache.py [utf8] Thu Oct 15 16:26:25 2009
@@ -97,8 +97,11 @@
except KeyError:
## not in local, check if it's in shared
for shared_cache in self.shared_caches:
- if shared_cache.has_key(cache_id, scope):
+ try:
cache_entry = shared_cache.get(cache_id, scope)
+ except KeyError:
+ pass
+ else:
value = cache_entry.getValue()
## update local cache
self.quick_cache.set(cache_id, scope, value,
More information about the Erp5-report
mailing list