def __setitem__(self, key, value): item = dict.get(self, key) if item is None: item = [key, value, time_func()] dict.__setitem__(self, key, item) else: item[1] = value self._manage_size()
def __getitem__(self, key): item = dict.__getitem__(self, key) item[2] = time_func() return item[1]