Skip to content

Commit d357b39

Browse files
jeejeeleeMu Huai
authored andcommitted
[Misc] Modify LRUCache touch (vllm-project#16689)
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Mu Huai <[email protected]>
1 parent 2b4a032 commit d357b39

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)