pub struct TwoLevelCache { /* private fields */ }Expand description
A two-level cache: a small hot cache backed by a larger cold cache.
Implementations§
Source§impl TwoLevelCache
impl TwoLevelCache
Sourcepub fn get(&mut self, key: u64) -> Option<u64>
pub fn get(&mut self, key: u64) -> Option<u64>
Look up a key; checks hot first, then cold (and promotes on hit).
Sourcepub fn insert(&mut self, key: u64, val: u64)
pub fn insert(&mut self, key: u64, val: u64)
Insert a value; placed in hot cache (evicts to cold if full).
Sourcepub fn stats(&self) -> &CacheSessionStats
pub fn stats(&self) -> &CacheSessionStats
Return a reference to the current session stats.
Auto Trait Implementations§
impl Freeze for TwoLevelCache
impl RefUnwindSafe for TwoLevelCache
impl Send for TwoLevelCache
impl Sync for TwoLevelCache
impl Unpin for TwoLevelCache
impl UnsafeUnpin for TwoLevelCache
impl UnwindSafe for TwoLevelCache
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