dont overwrite key

This commit is contained in:
j 2016-02-18 17:10:54 +05:30
parent fcb069c7de
commit 7cd5befb8a

View file

@ -8,10 +8,10 @@ class Cache(dict):
def get(self, key): def get(self, key):
now = time.time() now = time.time()
for key, value in list(self._added.items()): for k, value in list(self._added.items()):
if value < now: if value < now:
del self._added[key] del self._added[k]
del self[key] del self[k]
return dict.get(self, key) return dict.get(self, key)
def set(self, key, value, ttl=None): def set(self, key, value, ttl=None):