[RadixTree][8/N Refactor]: unify lock interface (#20330)

This commit is contained in:
pansicheng
2026-03-16 11:49:51 +08:00
committed by GitHub
parent f0458e0b49
commit 97b2a89334
11 changed files with 144 additions and 60 deletions
+9 -4
View File
@@ -9,8 +9,11 @@ import torch
from sglang.srt.mem_cache.base_prefix_cache import (
BasePrefixCache,
DecLockRefParams,
DecLockRefResult,
EvictParams,
EvictResult,
IncLockRefResult,
InsertParams,
InsertResult,
MatchPrefixParams,
@@ -80,11 +83,13 @@ class ChunkCache(BasePrefixCache):
def evict(self, params: EvictParams) -> EvictResult:
return EvictResult()
def inc_lock_ref(self, node: Any):
return 0
def inc_lock_ref(self, node: Any) -> IncLockRefResult:
return IncLockRefResult(delta=0)
def dec_lock_ref(self, node: Any, swa_uuid_for_lock: Optional[str] = None):
return 0
def dec_lock_ref(
self, node: Any, params: Optional[DecLockRefParams] = None
) -> DecLockRefResult:
return DecLockRefResult(delta=0)
def protected_size(self):
# NOTE: no protected size in chunk cache. Chunk cache's eviction is the same with request's lifecycle.