Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
645ea56f4c
  1. 4
      muk_utils/tools/cache.py

4
muk_utils/tools/cache.py

@ -49,14 +49,10 @@ class memoize(object):
kw = sorted(kwargs.items())
key = (args, tuple(kw))
try:
print("TRY CACHE")
value = self.cache[key]
print("VALUE")
if (current_time - value[1]) > self.timeout:
print("TIMEOUT")
raise KeyError
except KeyError:
print("NEW")
value = self.cache[key] = (func(*args,**kwargs), current_time)
return value[0]
return wrapper
Loading…
Cancel
Save