avoid concurrent key removal error
This commit is contained in:
parent
b50821ba85
commit
e531419364
1 changed files with 2 additions and 2 deletions
|
@ -10,8 +10,8 @@ class Cache(dict):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
for k, value in list(self._added.items()):
|
for k, value in list(self._added.items()):
|
||||||
if value < now:
|
if value < now:
|
||||||
del self._added[k]
|
self._added.pop(k, None)
|
||||||
del self[k]
|
self.pop(k, None)
|
||||||
return dict.get(self, key)
|
return dict.get(self, key)
|
||||||
|
|
||||||
def set(self, key, value, ttl=None):
|
def set(self, key, value, ttl=None):
|
||||||
|
|
Loading…
Reference in a new issue