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._dict = {}
|
||||||
self._recency = {}
|
self._recency = {}
|
||||||
|
|
||||||
|
def __contains__(self, key):
|
||||||
|
return key in self._dict
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
self._shrink()
|
self._shrink()
|
||||||
value = self._dict[key]
|
value = self._dict[key]
|
||||||
|
|
Loading…
Reference in a new issue