pub struct ClockCache { /* private fields */ }
Expand description
CLOCK algorithm cache implementation Uses reference bits and circular scanning for eviction
Implementations§
Source§impl ClockCache
impl ClockCache
pub fn new(stats: Arc<Statistics>) -> Self
Sourcepub fn get(&self, key: &[u8]) -> Option<Bytes>
pub fn get(&self, key: &[u8]) -> Option<Bytes>
Get value from cache, setting reference bit on access
Sourcepub fn insert(&self, key: Vec<u8>, value: Bytes)
pub fn insert(&self, key: Vec<u8>, value: Bytes)
Insert value into cache, triggering eviction if needed
Sourcepub fn evict_entries(&self)
pub fn evict_entries(&self)
CLOCK algorithm eviction - scan entries circularly, evicting those without reference bit
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get current cache statistics
Sourcepub fn adjust_watermarks(&self, high_mb: usize, low_mb: usize)
pub fn adjust_watermarks(&self, high_mb: usize, low_mb: usize)
Adjust cache watermarks dynamically
Auto Trait Implementations§
impl !Freeze for ClockCache
impl !RefUnwindSafe for ClockCache
impl Send for ClockCache
impl Sync for ClockCache
impl Unpin for ClockCache
impl UnwindSafe for ClockCache
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