[Erp5-report] r14046 - /erp5/trunk/products/ERP5Type/Cache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 11 14:13:49 CEST 2007
Author: jerome
Date: Wed Apr 11 14:13:47 2007
New Revision: 14046
URL: http://svn.erp5.org?rev=14046&view=rev
Log:
Start complaining about not found cache factories only after initialization.
Initialization process call some cached methods, and we don't want warnings
because the system is not initialized here.
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=14046&r1=14045&r2=14046&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Wed Apr 11 14:13:47 2007
@@ -36,15 +36,21 @@
DEFAULT_CACHE_SCOPE = 'GLOBAL'
DEFAULT_CACHE_FACTORY = 'erp5_ui_short'
is_cache_initialized = 0
+is_cache_ready = 0
def initializePortalCachingProperties(self):
""" Init CachingMethod properties."""
## check if global CachingMethod is initialized in RAM for this ERP5 site. If not init it
global is_cache_initialized
+ global is_cache_ready
if not is_cache_initialized:
+ # we set is_cache_initialized right now to prevent infinite loops
is_cache_initialized = 1
## update cache structure from portal_caches
self.getPortalObject().portal_caches.updateCache()
+ # we mark the cache as ready after initialization, because initialization
+ # itself will cause cache misses that we want to ignore
+ is_cache_ready = 1
class CacheFactory:
""" CacheFactory is a RAM based object which contains different cache plugin
@@ -187,8 +193,12 @@
self.callable_object, cache_id, scope, self.cache_duration,
*args, **kwd)
except KeyError:
- ## no caching enabled for this site or no such cache factory
- LOG("Cache.__call__", WARNING, "Factory %s not found, method %s execute without cache" %(self.cache_factory, self.callable_object))
+ global is_cache_ready
+ if is_cache_ready:
+ ## no caching enabled for this site or no such cache factory
+ LOG("Cache.__call__", WARNING,
+ "Factory %s not found, method %s executed without cache" % (
+ self.cache_factory, self.callable_object))
value = self.callable_object(*args, **kwd)
return value
More information about the Erp5-report
mailing list