RadixCache method adjust (#977)

This commit is contained in:
Liangsheng Yin
2024-08-07 15:52:24 -07:00
committed by GitHub
parent f724f1f1e9
commit 7623091d97
5 changed files with 140 additions and 118 deletions

View File

@@ -0,0 +1,47 @@
from abc import ABC, abstractmethod
class BasePrefixCache(ABC):
"""Cache can be indexed by either rid or key."""
@abstractmethod
def reset(self):
pass
@abstractmethod
def match_prefix(self, **kwargs):
pass
@abstractmethod
def insert(self, **kwargs):
pass
@abstractmethod
def cache_finished_req(self, **kwargs):
pass
@abstractmethod
def cache_unfinished_req(self, **kwargs):
pass
@abstractmethod
def evict(self, num_tokens, evict_callback):
pass
@abstractmethod
def inc_lock_ref(self, node):
pass
@abstractmethod
def dec_lock_ref(self, node):
pass
@abstractmethod
def evictable_size(self):
pass
def total_size(self):
raise NotImplementedError
def pretty_print(self):
raise NotImplementedError