pub struct CacheState {
pub cached_prefix_len: usize,
/* private fields */
}Expand description
Tracks the cache lifecycle across turns.
Call advance_turn once per turn to get the
appropriate CacheHint. Call reset when the adapter
reports a cache miss so the next turn re-sends a Write.
Fields§
§cached_prefix_len: usizeNumber of tokens in the cached prefix (set after annotation).
Implementations§
Source§impl CacheState
impl CacheState
Sourcepub const fn advance_turn(&mut self, config: &CacheConfig) -> CacheHint
pub const fn advance_turn(&mut self, config: &CacheConfig) -> CacheHint
Advance the turn counter and return the cache hint for this turn.
- First turn (or after reset/refresh): returns
Write { ttl }. - Subsequent turns within
cache_intervals: returnsRead. - After
cache_intervalsturns: returnsWrite(refresh).
Trait Implementations§
Source§impl Clone for CacheState
impl Clone for CacheState
Source§fn clone(&self) -> CacheState
fn clone(&self) -> CacheState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheState
impl Debug for CacheState
Auto Trait Implementations§
impl Freeze for CacheState
impl RefUnwindSafe for CacheState
impl Send for CacheState
impl Sync for CacheState
impl Unpin for CacheState
impl UnsafeUnpin for CacheState
impl UnwindSafe for CacheState
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