def _cache(self, item: CacheItem):
scope = item.scope
if item.key in self.cache:
raise Exception("Added same item twice")
self.cache[item.key] = item
if scope.version != 0:
try:
self.keysforVersion[scope.version].add(item.key)
except KeyError:
raise Exception("Added data to version that is not open")
bisect.insort_right(self.timerqueue, item)
if item.time < self.nextAction:
self.nextAction = item.time
self._advance_time()
评论列表
文章目录