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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 15 21:52:03 CEST 2009


Author: yo
Date: Thu Oct 15 21:52:02 2009
New Revision: 29693

URL: http://svn.erp5.org?rev=29693&view=rev
Log:
Import time.time for better performance.

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=29693&r1=29692&r2=29693&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/BaseCache.py [utf8] Thu Oct 15 21:52:02 2009
@@ -30,7 +30,7 @@
 """ 
 Base Cache plugin.
 """
-import time
+from time import time
 
 class CachedMethodError(Exception):
   pass
@@ -51,7 +51,7 @@
     if cache_duration in (None, 0):
       self.expires_at = None
     else:
-      self.expires_at = time.time() + cache_duration
+      self.expires_at = time() + cache_duration
     self._cache_hit_count = 0
     self.calculation_time = calculation_time
 
@@ -60,7 +60,7 @@
       - None means allways expire
       - 0 means never expire
     """
-    return self.expires_at is None or self.expires_at < time.time()
+    return self.expires_at is None or self.expires_at < time()
 
   def markCacheHit(self, delta=1):
     """ mark a read to this cache entry """
@@ -101,7 +101,7 @@
   cache_expire_check_interval = 60
 
   def __init__(self, params={}):
-    self._next_cache_expire_check_at = time.time()
+    self._next_cache_expire_check_at = time()
     self._cache_hit_count = 0
     self._cache_miss_count = 0
 




More information about the Erp5-report mailing list