pub struct ResidentPrefixCache { /* private fields */ }Implementations§
Source§impl ResidentPrefixCache
impl ResidentPrefixCache
pub fn new(config: ResidentCacheConfig) -> Self
pub fn lookup(&mut self, page_id: &str) -> Option<ResidentPrefixLookup>
pub fn acquire(&mut self, page_id: &str) -> Option<ResidentPrefixLookup>
pub fn release(&mut self, page_id: &str)
pub fn allocate_for_record( &mut self, page_id: &str, token_count: u64, estimated_bytes: u64, drop_evicted: impl FnMut(i32) -> Result<()>, ) -> Result<ResidentPrefixAllocation>
pub fn commit_record( &mut self, page_id: String, seq_id: i32, token_count: u64, estimated_bytes: u64, )
Sourcepub fn evict_one_lru_entry(
&mut self,
drop_evicted: &mut impl FnMut(i32) -> Result<()>,
) -> Result<Option<ResidentPrefixEviction>>
pub fn evict_one_lru_entry( &mut self, drop_evicted: &mut impl FnMut(i32) -> Result<()>, ) -> Result<Option<ResidentPrefixEviction>>
Evict one LRU entry (the entry with the smallest last_used
that is not currently borrowed). Returns the evicted entry
metadata, or None if there is nothing to evict.
This is the proactive eviction path: it runs outside the
normal allocate_for_record flow so that the decode loop can
free KV cells before grammar-triggered retries need them.
Sourcepub fn evict_lru_until_tokens(
&mut self,
min_tokens: u64,
drop_evicted: &mut impl FnMut(i32) -> Result<()>,
) -> Result<Vec<ResidentPrefixEviction>>
pub fn evict_lru_until_tokens( &mut self, min_tokens: u64, drop_evicted: &mut impl FnMut(i32) -> Result<()>, ) -> Result<Vec<ResidentPrefixEviction>>
Evict LRU entries until at least min_tokens have been released,
or until no non-borrowed entry remains. Returns the entries that
were actually evicted.
pub fn stats(&self) -> ResidentPrefixCacheStats
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResidentPrefixCache
impl RefUnwindSafe for ResidentPrefixCache
impl Send for ResidentPrefixCache
impl Sync for ResidentPrefixCache
impl Unpin for ResidentPrefixCache
impl UnsafeUnpin for ResidentPrefixCache
impl UnwindSafe for ResidentPrefixCache
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