Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
41628dc1
Unverified
Commit
41628dc1
authored
Sep 07, 2025
by
Teng Ma
Committed by
GitHub
Sep 06, 2025
Browse files
[HiCache] fix: check clear() method for storage backend (#10096)
Co-authored-by:
hzh0425
<
hzh0425@apache.org
>
parent
a12061df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
python/sglang/srt/mem_cache/hiradix_cache.py
python/sglang/srt/mem_cache/hiradix_cache.py
+17
-4
No files found.
python/sglang/srt/mem_cache/hiradix_cache.py
View file @
41628dc1
...
@@ -134,11 +134,24 @@ class HiRadixCache(RadixCache):
...
@@ -134,11 +134,24 @@ class HiRadixCache(RadixCache):
height
+=
1
height
+=
1
return
height
return
height
def
clear_storage_backend
(
self
):
def
clear_storage_backend
(
self
)
->
bool
:
if
self
.
enable_storage
:
if
self
.
enable_storage
:
self
.
cache_controller
.
storage_backend
.
clear
()
try
:
logger
.
info
(
"Hierarchical cache storage backend cleared successfully!"
)
# Check if the storage backend has a clear method (for nixl backends)
return
True
if
hasattr
(
self
.
cache_controller
.
storage_backend
,
"clear"
):
self
.
cache_controller
.
storage_backend
.
clear
()
logger
.
info
(
"Hierarchical cache storage backend cleared successfully!"
)
return
True
else
:
logger
.
warning
(
f
"Storage backend
{
type
(
self
.
cache_controller
.
storage_backend
).
__name__
}
does not support clear operation."
)
return
False
except
Exception
as
e
:
logger
.
error
(
f
"Failed to clear hierarchical cache storage backend:
{
e
}
"
)
return
False
else
:
else
:
logger
.
warning
(
"Hierarchical cache storage backend is not enabled."
)
logger
.
warning
(
"Hierarchical cache storage backend is not enabled."
)
return
False
return
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment