Explorar o código

lrucache: remove unneeded move_to_end call, already at end

Thomas Waldmann hai 1 mes
pai
achega
211bb3225c
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      src/borg/helpers/lrucache.py

+ 1 - 2
src/borg/helpers/lrucache.py

@@ -30,8 +30,7 @@ class LRUCache(MutableMapping[K, V]):
         ), "Unexpected attempt to replace a cached item without first deleting the old item."
         while len(self._cache) >= self._capacity:
             self._dispose(self._cache.popitem(last=False)[1])
-        self._cache[key] = value
-        self._cache.move_to_end(key)
+        self._cache[key] = value  # add new entry at the end
 
     def __getitem__(self, key: K) -> V:
         self._cache.move_to_end(key)  # raise KeyError if not found