[Erp5-report] r29692 - /erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 15 21:50:34 CEST 2009


Author: yo
Date: Thu Oct 15 21:50:32 2009
New Revision: 29692

URL: http://svn.erp5.org?rev=29692&view=rev
Log:
If cache_duration is zero, set self.expires_at to None to avoid a needless comparison.

Modified:
    erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py

Modified: erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py?rev=29692&r1=29691&r2=29692&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py [utf8] Thu Oct 15 21:50:32 2009
@@ -49,7 +49,7 @@
   def __init__(self, value, cache_duration=None, calculation_time=0):
     self.value = value
     if cache_duration in (None, 0):
-      self.expires_at = cache_duration
+      self.expires_at = None
     else:
       self.expires_at = time.time() + cache_duration
     self._cache_hit_count = 0
@@ -60,7 +60,7 @@
       - None means allways expire
       - 0 means never expire
     """
-    return self.expires_at is None or self.expires_at != 0 and self.expires_at < time.time()
+    return self.expires_at is None or self.expires_at < time.time()
 
   def markCacheHit(self, delta=1):
     """ mark a read to this cache entry """




More information about the Erp5-report mailing list