avoid concurrent key removal error

This commit is contained in:
j 2016-02-23 20:51:26 +05:30
parent b50821ba85
commit e531419364

View file

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