Add clear method
This commit is contained in:
parent
d7bf0aec29
commit
828c5ba079
1 changed files with 4 additions and 0 deletions
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue