pub struct AttentionCache { /* private fields */ }Implementations§
Source§impl AttentionCache
impl AttentionCache
pub fn new(config: CacheConfig) -> Self
Sourcepub fn get(
&mut self,
dag: &QueryDag,
mechanism: &str,
) -> Option<AttentionScores>
pub fn get( &mut self, dag: &QueryDag, mechanism: &str, ) -> Option<AttentionScores>
Get cached scores for a DAG and mechanism
Sourcepub fn insert(
&mut self,
dag: &QueryDag,
mechanism: &str,
scores: AttentionScores,
)
pub fn insert( &mut self, dag: &QueryDag, mechanism: &str, scores: AttentionScores, )
Insert scores into cache
Sourcepub fn evict_expired(&mut self)
pub fn evict_expired(&mut self)
Remove expired entries
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn most_accessed(&self) -> Option<(&u64, usize)>
pub fn most_accessed(&self) -> Option<(&u64, usize)>
Get entry with most accesses
Auto Trait Implementations§
impl Freeze for AttentionCache
impl RefUnwindSafe for AttentionCache
impl Send for AttentionCache
impl Sync for AttentionCache
impl Unpin for AttentionCache
impl UnsafeUnpin for AttentionCache
impl UnwindSafe for AttentionCache
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