pub struct VersionedCache { /* private fields */ }Expand description
A versioned cache that associates a monotonic version number with each entry.
Implementations§
Source§impl VersionedCache
impl VersionedCache
Sourcepub fn bump_version(&mut self)
pub fn bump_version(&mut self)
Bump the version (e.g., after a global environment change).
Sourcepub fn get(&self, key: u64) -> Option<u64>
pub fn get(&self, key: u64) -> Option<u64>
Look up a value; returns None if the entry’s version is stale.
Sourcepub fn evict_stale(&mut self)
pub fn evict_stale(&mut self)
Evict all entries from a previous version.
Sourcepub fn valid_count(&self) -> usize
pub fn valid_count(&self) -> usize
Return the number of valid (current-version) entries.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VersionedCache
impl RefUnwindSafe for VersionedCache
impl Send for VersionedCache
impl Sync for VersionedCache
impl Unpin for VersionedCache
impl UnsafeUnpin for VersionedCache
impl UnwindSafe for VersionedCache
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