From 0b8c5721f1ed373d75c4bcc8cbdfad0de8c1770a Mon Sep 17 00:00:00 2001 From: Zhiqiang Xie Date: Fri, 5 Sep 2025 19:27:26 -0700 Subject: [PATCH] [HiStorage] Remove delete and clear as necessary methods (#10039) --- .../sglang/srt/mem_cache/hicache_storage.py | 23 ------------------- .../storage/mooncake_store/mooncake_store.py | 3 --- 2 files changed, 26 deletions(-) diff --git a/python/sglang/srt/mem_cache/hicache_storage.py b/python/sglang/srt/mem_cache/hicache_storage.py index d5b4540f4..6ec077db5 100644 --- a/python/sglang/srt/mem_cache/hicache_storage.py +++ b/python/sglang/srt/mem_cache/hicache_storage.py @@ -103,20 +103,6 @@ class HiCacheStorage(ABC): """ pass - @abstractmethod - def delete(self, key: str) -> bool: - """ - Delete the entry associated with the given key. - """ - pass - - @abstractmethod - def clear(self) -> bool: - """ - Clear all entries in the storage. - """ - pass - def batch_exists(self, keys: List[str]) -> int: """ Check if the keys exist in the storage. @@ -227,15 +213,6 @@ class HiCacheFile(HiCacheStorage): tensor_path = os.path.join(self.file_path, f"{key}.bin") return os.path.exists(tensor_path) - def delete(self, key: str) -> None: - key = self._get_suffixed_key(key) - tensor_path = os.path.join(self.file_path, f"{key}.bin") - try: - os.remove(tensor_path) - except FileNotFoundError: - logger.warning(f"Key {key} does not exist. Cannot delete.") - return - def clear(self) -> bool: try: for filename in os.listdir(self.file_path): diff --git a/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py b/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py index 616242d32..55262971d 100644 --- a/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py +++ b/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py @@ -264,9 +264,6 @@ class MooncakeStore(HiCacheStorage): return i // key_multiplier return len(query_keys) // key_multiplier - def delete(self, key) -> None: - raise (NotImplementedError) - def close(self): # MooncakeDistributedStore will automatically call the destructor, so # it is unnecessary to close it manually.