Commit 7def223f authored by Nicolas Delaby's avatar Nicolas Delaby

Check that CacheEntry is not expired in has_key.

If so, delete cached value and return False.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29455 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 361d41e7
...@@ -109,7 +109,15 @@ class RamCache(BaseCache): ...@@ -109,7 +109,15 @@ class RamCache(BaseCache):
def has_key(self, cache_id, scope): def has_key(self, cache_id, scope):
cache = self.getCacheStorage() cache = self.getCacheStorage()
return cache.has_key((scope, cache_id)) cache_entry = cache.get((scope, cache_id))
to_return = False
if isinstance(cache_entry, CacheEntry):
if cache_entry.isExpired():
#Delete expired CacheEntry
self.delete(cache_id, scope)
else:
to_return = True
return to_return
def getScopeList(self): def getScopeList(self):
scope_set = set() scope_set = set()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment