From 0f59961683ba7266a49694ac2e7467c9ef201700 Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Thu, 15 Oct 2009 19:52:02 +0000 Subject: [PATCH] Import time.time for better performance. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29693 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/CachePlugins/BaseCache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/ERP5Type/CachePlugins/BaseCache.py b/product/ERP5Type/CachePlugins/BaseCache.py index 6c3254aa93..2066a824e7 100644 --- a/product/ERP5Type/CachePlugins/BaseCache.py +++ b/product/ERP5Type/CachePlugins/BaseCache.py @@ -30,7 +30,7 @@ """ Base Cache plugin. """ -import time +from time import time class CachedMethodError(Exception): pass @@ -51,7 +51,7 @@ class CacheEntry(object): 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 @@ class CacheEntry(object): - 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 @@ class BaseCache(object): 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 -- 2.30.9