Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

in our automation (bamboo/reggie) PersistentCaching is disabled due to some long forgotten bug, #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion easypy/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm not following this correctly, but wouldn't this override self._timecache_clear to be the cache_clear of the last returned cache? If the PersistentCache is called multiple times, clear() will only clear the cache of the last call?


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...
Expand Down Expand Up @@ -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
Expand Down