Browse Source

Merge pull request #24 from mengskysama/patch-2

Update lru_cache.py
master
BreakWa11 9 years ago
parent
commit
1e41de7d0b
  1. 2
      shadowsocks/lru_cache.py

2
shadowsocks/lru_cache.py

@ -88,12 +88,12 @@ class LRUCache(collections.MutableMapping):
self.close_callback(value) self.close_callback(value)
self._closed_values.add(value) self._closed_values.add(value)
for key in self._time_to_keys[least]: for key in self._time_to_keys[least]:
self._last_visits.popleft()
if key in self._store: if key in self._store:
if now - self._keys_to_last_time[key] > self.timeout: if now - self._keys_to_last_time[key] > self.timeout:
del self._store[key] del self._store[key]
del self._keys_to_last_time[key] del self._keys_to_last_time[key]
c += 1 c += 1
self._last_visits.popleft()
del self._time_to_keys[least] del self._time_to_keys[least]
if c: if c:
self._closed_values.clear() self._closed_values.clear()

Loading…
Cancel
Save