Commit d416ef9b authored by Vincent Pelletier's avatar Vincent Pelletier

Make possible to have infinite cache (still limited to zope scope, will get...

Make possible to have infinite cache (still limited to zope scope, will get flushed when zope is restarted) by allowing to specify None as a duration.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9047 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc6712e4
......@@ -113,7 +113,7 @@ class CachingMethod:
try:
for index in CachingMethod.cached_object_dict.keys():
obj = CachingMethod.cached_object_dict[index]
if obj.time + obj.duration < now:
if obj.duration is not None and obj.time + obj.duration < now:
# LOG('CachingMethod', 0, 'expire %s' % index)
del CachingMethod.cached_object_dict[index]
except KeyError:
......@@ -131,7 +131,7 @@ class CachingMethod:
index = str(index)
obj = CachingMethod.cached_object_dict.get(index)
if obj is None or obj.time + obj.duration < now:
if obj is None or (obj.duration is not None and obj.time + obj.duration < now):
#LOG('CachingMethod', 0, 'cache miss: id = %s, duration = %s, method = %s, args = %s, kwd = %s' % (str(self.id), str(self.duration), str(self.method), str(args), str(kwd)))
obj = CachedObject()
obj.time = now
......
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