Skip to main content
Session-aware radix caching improves cache hits for long-lived, multi-turn workloads under memory pressure. It registers reusable KV to a session and evicts unreferenced KV before KV still referenced by an active session. Session references are soft protection, not memory pins. Referenced KV can still be evicted when reclaiming unreferenced KV is insufficient.

Enable the cache

This feature is implemented only by UnifiedRadixCache.
Command

Pass and close the session

Your application must pass the same top-level session_id on every request in a session. The ID labels cache references only; it does not append or reconstruct conversation context, so each request must still contain the intended prompt.
Command
When a request finishes, SGLang automatically registers its reusable cache leaves under the session_id. This reference-only workflow does not require an /open_session call. Call /close_session when the application session ends, including error and cancellation paths:
Command
Closing removes the session’s references but does not immediately free its KV. The KV remains reusable and returns to the normal eviction order.

Eviction behavior

The cache tracks references independently for each UnifiedRadixCache component. Device and host eviction use the same session preference. UnifiedRadixCache still applies component cascade rules. Evicting an internal Full node also evicts its SWA and Mamba data; evicting SWA also evicts Mamba data; evicting Mamba affects only Mamba. Evicting a leaf removes all component data on that leaf.