pub struct SectionCache { /* private fields */ }Expand description
Section cache with statistics
Implementations§
Source§impl SectionCache
impl SectionCache
Sourcepub fn with_max_age(max_age: Duration) -> Self
pub fn with_max_age(max_age: Duration) -> Self
Create cache with custom max age
Sourcepub fn get_or_compute<F>(&self, key: &CacheKey, compute: F) -> String
pub fn get_or_compute<F>(&self, key: &CacheKey, compute: F) -> String
Get or compute (cache miss pattern)
Sourcepub fn clear_profile(&self, profile: &str)
pub fn clear_profile(&self, profile: &str)
Clear entries for a specific profile
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get statistics
Sourcepub fn cached_tokens(&self) -> usize
pub fn cached_tokens(&self) -> usize
Get total cached token count
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SectionCache
impl RefUnwindSafe for SectionCache
impl Send for SectionCache
impl Sync for SectionCache
impl Unpin for SectionCache
impl UnsafeUnpin for SectionCache
impl UnwindSafe for SectionCache
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