Define cacheclass.__contains__.

master
Ethan Dalool 2018-03-18 20:58:00 -07:00
parent 538ab4e61c
commit c09247e850
1 changed files with 3 additions and 0 deletions

View File

@ -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]