diff --git a/oml/cache.py b/oml/cache.py index dd0e823..7c5368d 100644 --- a/oml/cache.py +++ b/oml/cache.py @@ -7,12 +7,12 @@ class Cache(dict): self._added = {} def get(self, key): - if key in self._added: - if self._added[key] < time.time(): + now = time.time() + for key, value in self._added.items(): + if value < now: del self._added[key] del self[key] - return - return dict.__getitem__(self, key) + return dict.get(self, key) def set(self, key, value, ttl=None): ttl = ttl or self._ttl