Fix check if the item doesn't exist in the ttl cache

This commit is contained in:
Thomas Jackson 2014-03-05 18:00:08 -08:00
parent c4bb78a3fe
commit 4f07cd9b82

View File

@ -15,6 +15,8 @@ class CacheDict(dict):
'''
Enforce the TTL to a specific key, delete if its past TTL
'''
if key not in self._key_cache_time:
return
if time.time() - self._key_cache_time[key] > self._ttl:
del self._key_cache_time[key]
dict.__delitem__(self, key)