pub struct RecordCache { /* private fields */ }Expand description
Thread safe, byte bounded record cache.
Implementations§
Source§impl RecordCache
impl RecordCache
Sourcepub fn new(capacity: u64) -> Self
pub fn new(capacity: u64) -> Self
A cache holding up to capacity bytes of records. Zero disables it.
Sourcepub fn get(&self, locator: u64) -> Option<MemoryNode>
pub fn get(&self, locator: u64) -> Option<MemoryNode>
The cached node for locator, counting a hit or a miss.
Sourcepub fn insert(&self, locator: u64, node: MemoryNode, charge: u64)
pub fn insert(&self, locator: u64, node: MemoryNode, charge: u64)
Cache node for locator, charged charge bytes, replacing any
previous entry. A record larger than the whole cache is not cached.
Sourcepub fn invalidate(&self, locator: u64)
pub fn invalidate(&self, locator: u64)
Drop the entry for locator, if cached.
Sourcepub fn set_capacity(&self, capacity: u64)
pub fn set_capacity(&self, capacity: u64)
Change the capacity, evicting as needed to fit the new bound.
Sourcepub fn stats(&self) -> BufferStats
pub fn stats(&self) -> BufferStats
Activity counters and residency.
Auto Trait Implementations§
impl !Freeze for RecordCache
impl !RefUnwindSafe for RecordCache
impl Send for RecordCache
impl Sync for RecordCache
impl Unpin for RecordCache
impl UnsafeUnpin for RecordCache
impl UnwindSafe for RecordCache
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