Define cacheclass.__contains__.
This commit is contained in:
parent
538ab4e61c
commit
c09247e850
1 changed files with 3 additions and 0 deletions
|
@ -12,6 +12,9 @@ class Cache:
|
|||
self._dict = {}
|
||||
self._recency = {}
|
||||
|
||||
def __contains__(self, key):
|
||||
return key in self._dict
|
||||
|
||||
def __getitem__(self, key):
|
||||
self._shrink()
|
||||
value = self._dict[key]
|
||||
|
|
Loading…
Reference in a new issue