pub struct NoPrefixCaching;Expand description
2026-09-26: No-op prefix cache: is_active is false, every lookup is
empty, and every insert and eviction reports nothing.
Trait Implementations§
Source§impl PrefixCache for NoPrefixCaching
impl PrefixCache for NoPrefixCaching
Source§fn is_active(&self) -> bool
fn is_active(&self) -> bool
2026-09-26: Whether this cache stores blocks and holds references.
NoPrefixCaching answers false, and callers then skip the cache’s
bookkeeping.Source§fn lookup(
&self,
_tokens: &[u32],
_block_size: usize,
_session_hash: u64,
_adapter_id: u64,
) -> PrefixMatch
fn lookup( &self, _tokens: &[u32], _block_size: usize, _session_hash: u64, _adapter_id: u64, ) -> PrefixMatch
2026-09-26: Look up
tokens and return the cached KV blocks of the
longest matching prefix, taking a reference on each full matched block
so it survives eviction until PrefixCache::release. Read moreSource§fn insert(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_matched_tokens: usize,
_adapter_id: u64,
) -> InsertAcquired
fn insert( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _matched_tokens: usize, _adapter_id: u64, ) -> InsertAcquired
2026-09-26: Insert a completed prefill’s blocks. Read more
Source§fn insert_with_snapshot(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_snapshot_id: usize,
_session_hash: u64,
_matched_tokens: usize,
_adapter_id: u64,
) -> (Option<usize>, InsertAcquired)
fn insert_with_snapshot( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _snapshot_id: usize, _session_hash: u64, _matched_tokens: usize, _adapter_id: u64, ) -> (Option<usize>, InsertAcquired)
2026-09-26:
insert, then register snapshot_id (a snapshot-pool
slot) for the whole of tokens, tagged with session_hash. Returns
the displaced resident slot for the caller to free, if any, and the
insert’s InsertAcquired.Source§fn insert_intermediate_snapshot(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_snapshot_id: usize,
_session_hash: u64,
_matched_tokens: usize,
_adapter_id: u64,
) -> Option<usize>
fn insert_intermediate_snapshot( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _snapshot_id: usize, _session_hash: u64, _matched_tokens: usize, _adapter_id: u64, ) -> Option<usize>
2026-09-26: Register
snapshot_id for tokens, the sequence up to the
snapshot point, tagged with session_hash. Returns the displaced
resident slot for the caller to free, if any.Source§fn insert_tail_snapshot(
&self,
_tokens: &[u32],
_snapshot_id: usize,
_session_hash: u64,
_adapter_id: u64,
) -> Vec<usize>
fn insert_tail_snapshot( &self, _tokens: &[u32], _snapshot_id: usize, _session_hash: u64, _adapter_id: u64, ) -> Vec<usize>
2026-09-26: Register the session’s tail snapshot in the index only. For
a nonzero
session_hash it replaces the session’s previous tail and
tail sibling. Returns the displaced snapshot ids to free.Source§fn insert_tail_sibling_snapshot(
&self,
_tokens: &[u32],
_snapshot_id: usize,
_session_hash: u64,
_adapter_id: u64,
) -> Option<usize>
fn insert_tail_sibling_snapshot( &self, _tokens: &[u32], _snapshot_id: usize, _session_hash: u64, _adapter_id: u64, ) -> Option<usize>
2026-09-26: Register the tail’s sibling snapshot in the index. Call it
after
insert_tail_snapshot, which removes the session’s previous
sibling. Returns a displaced snapshot id to free, if any.Source§fn release(&self, _tokens: &[u32], _block_size: usize, _adapter_id: u64)
fn release(&self, _tokens: &[u32], _block_size: usize, _adapter_id: u64)
2026-09-26: Drop the sequence’s reference on each full block of
tokens the cache holds, when the sequence finishes. adapter_id must
be the one used at lookup and insert.Source§fn release_matched(
&self,
_tokens: &[u32],
_block_size: usize,
_matched_tokens: usize,
_adapter_id: u64,
)
fn release_matched( &self, _tokens: &[u32], _block_size: usize, _matched_tokens: usize, _adapter_id: u64, )
2026-09-26: Drop the references one
lookup took: the full blocks of
the first matched_tokens tokens and no more, for a caller that rolls
back a lookup before any sequence owns its blocks.Source§fn evict(&self, _num_blocks: usize) -> EvictedBlocks
fn evict(&self, _num_blocks: usize) -> EvictedBlocks
2026-09-26: Evict least-recently-used leaves that no sequence holds
until at least
num_blocks blocks are freed or none is left. A leaf’s
partial-suffix block goes with it, so one more block than asked can
come back. The caller applies the EvictedBlocks.Source§fn evict_snapshot_lru(&self) -> Option<usize>
fn evict_snapshot_lru(&self) -> Option<usize>
2026-09-26: Evict one SSM snapshot from the index; returns its slot for
the caller to free.
Source§fn snapshot_count(&self) -> usize
fn snapshot_count(&self) -> usize
2026-09-26: Number of SSM snapshots in the snapshot index.
Source§fn stats(&self) -> (usize, usize)
fn stats(&self) -> (usize, usize)
2026-09-26:
(entries, cached_blocks). RadixTree stores one block
per entry and answers its node count for both.Source§fn peek_matched_tokens(
&self,
_tokens: &[u32],
_block_size: usize,
_adapter_id: u64,
) -> usize
fn peek_matched_tokens( &self, _tokens: &[u32], _block_size: usize, _adapter_id: u64, ) -> usize
2026-09-26: The number of tokens
lookup would match, without taking
references, touching LRU state or counting a hit or miss. Keyed by
adapter_id like lookup. The default answers 0.Source§fn pin_prefix(
&self,
_tokens: &[u32],
_block_size: usize,
_adapter_id: u64,
) -> usize
fn pin_prefix( &self, _tokens: &[u32], _block_size: usize, _adapter_id: u64, ) -> usize
2026-09-30: Take a reference on each full block of the prefix
lookup would match,
without the snapshot lookup or a hit or miss count, so eviction skips that prefix until
PrefixCache::release_matched with the returned token count. The default pins nothing
and answers 0.Source§fn evict_snapshot_to_tier(&self, min_tokens: usize) -> Option<TierEvict>
fn evict_snapshot_to_tier(&self, min_tokens: usize) -> Option<TierEvict>
2026-09-26: Pick a resident snapshot to evict: one at least
min_tokens deep is marked spilled and stays findable, a shallower one
is removed (TierEvict). min_tokens == 0 always spills. None
when nothing is resident; the default answers None.Source§fn promote_snapshot(&self, key: u64, new_slot: usize) -> bool
fn promote_snapshot(&self, key: u64, new_slot: usize) -> bool
2026-09-26: After the caller faulted a spilled snapshot into
new_slot, make its entry resident there. false if the key is
unknown; the default answers false.Source§fn forget_snapshot_tier_key(&self, key: u64) -> bool
fn forget_snapshot_tier_key(&self, key: u64) -> bool
2026-09-26: Remove the spilled entry for
key, for a caller whose
stored bytes for it are gone, so later lookups stop returning it. A
resident entry is left alone, since its slot is live. Returns whether
an entry was removed; the default answers false.Auto Trait Implementations§
impl Freeze for NoPrefixCaching
impl RefUnwindSafe for NoPrefixCaching
impl Send for NoPrefixCaching
impl Sync for NoPrefixCaching
impl Unpin for NoPrefixCaching
impl UnwindSafe for NoPrefixCaching
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more