Add clear method

This commit is contained in:
Ethan Dalool 2017-05-06 18:28:41 -07:00
parent d7bf0aec29
commit 828c5ba079

View file

@ -50,6 +50,10 @@ class Cache:
if age > self.maxage: if age > self.maxage:
self.remove(key) self.remove(key)
def clear(self):
self._dict.clear()
self._recency.clear()
def get(self, key, fallback=None): def get(self, key, fallback=None):
try: try:
return self[key] return self[key]