Define cacheclass.__contains__.

This commit is contained in:
Ethan Dalool 2018-03-18 20:58:00 -07:00
parent 538ab4e61c
commit c09247e850

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]