Skip to content

Commit 0d7d05f

Browse files
authored
[Misc] Modify LRUCache touch (#16689)
Signed-off-by: Jee Jee Li <[email protected]>
1 parent 96bb8aa commit 0d7d05f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vllm/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ def stat(self, *, delta: bool = False) -> CacheInfo:
316316
return info
317317

318318
def touch(self, key: _K) -> None:
319-
self._LRUCache__update(key) # type: ignore
319+
try:
320+
self._LRUCache__order.move_to_end(key) # type: ignore
321+
except KeyError:
322+
self._LRUCache__order[key] = None # type: ignore
320323

321324
@overload
322325
def get(self, key: _K, /) -> Optional[_V]:

0 commit comments

Comments
 (0)