diff --git a/easypy/caching.py b/easypy/caching.py index 122c8a3f..8a9a51e2 100644 --- a/easypy/caching.py +++ b/easypy/caching.py @@ -141,12 +141,17 @@ def inner(*args, **kwargs): ret = func(*args, **kwargs) self.set(key, ret) return ret + + inner = timecache(expiration=self.expiration)(inner) + self._timecache_clear = inner.cache_clear + inner.clear_cache = self.clear return inner def clear(self): with self.db_opened() as db: db.clear() + self._timecache_clear() def locking_lru_cache(maxsize=128, typed=False): # can't implement ignored_keywords because we use python's lru_cache... @@ -247,7 +252,7 @@ def inner(*args, **kwargs): with key_lock: result, ts = cache.get(key, NOT_CACHED) - if expiration <= 0: + if expiration is None or expiration <= 0: pass # nothing to fuss with, cache does not expire elif result is NOT_FOUND: pass # cache is empty