diff --git a/vllm/utils/cache.py b/vllm/utils/cache.py index 4338983f90..5f7647dce6 100644 --- a/vllm/utils/cache.py +++ b/vllm/utils/cache.py @@ -118,10 +118,8 @@ class LRUCache(cachetools.LRUCache[_K, _V]): return info def touch(self, key: _K) -> None: - try: + if key in self: self._LRUCache__order.move_to_end(key) # type: ignore - except KeyError: - self._LRUCache__order[key] = None # type: ignore @overload def get(self, key: _K, /) -> _V | None: ...