restore old jsonfile behaviour on key expiration

fixes #14456, now it won't expire keys in middle of a play when they
were 'valid' at 'gather time'.
pull/15758/merge
Brian Coca 8 years ago
parent dae1d4dbb7
commit f576082949

@ -62,13 +62,16 @@ class CacheModule(BaseCacheModule):
return None
def get(self, key):
if self.has_expired(key) or key == "":
raise KeyError
""" This checks the in memory cache first as the fact was not expired at 'gather time'
and it would be problematic if the key did expire after some long running tasks and
user gets 'undefined' error in the same play """
if key in self._cache:
return self._cache.get(key)
if self.has_expired(key) or key == "":
raise KeyError
cachefile = "%s/%s" % (self._cache_dir, key)
try:
with codecs.open(cachefile, 'r', encoding='utf-8') as f:

Loading…
Cancel
Save