Unverified Commit 0d7d05f4 authored by Jee Jee Li's avatar Jee Jee Li Committed by GitHub
Browse files

[Misc] Modify LRUCache touch (#16689)


Signed-off-by: default avatarJee Jee Li <pandaleefree@gmail.com>
parent 96bb8aa6
...@@ -316,7 +316,10 @@ class LRUCache(cachetools.LRUCache[_K, _V], Generic[_K, _V]): ...@@ -316,7 +316,10 @@ class LRUCache(cachetools.LRUCache[_K, _V], Generic[_K, _V]):
return info return info
def touch(self, key: _K) -> None: def touch(self, key: _K) -> None:
self._LRUCache__update(key) # type: ignore try:
self._LRUCache__order.move_to_end(key) # type: ignore
except KeyError:
self._LRUCache__order[key] = None # type: ignore
@overload @overload
def get(self, key: _K, /) -> Optional[_V]: def get(self, key: _K, /) -> Optional[_V]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment