pub struct PageCache<K, V, W = NoOpWriter>{ /* private fields */ }Expand description
SIEVE Page Cache
Implementations§
Source§impl<K, V> PageCache<K, V, NoOpWriter>
impl<K, V> PageCache<K, V, NoOpWriter>
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create new cache with default writer
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with specific capacity
Source§impl<K, V, W> PageCache<K, V, W>
impl<K, V, W> PageCache<K, V, W>
Sourcepub fn with_writer(config: CacheConfig, writer: W) -> Self
pub fn with_writer(config: CacheConfig, writer: W) -> Self
Create new cache with custom writer
Sourcepub fn get_with(&self, key: &K, strategy: BufferAccessStrategy) -> Option<V>
pub fn get_with(&self, key: &K, strategy: BufferAccessStrategy) -> Option<V>
Strategy-aware get.
Normal behaves exactly like PageCache::get. Non-Normal
strategies look in the main pool first (a hit is a free win),
then fall through to the strategy’s dedicated ring buffer.
Hits in the ring do NOT promote the page into the main pool —
that is the whole point of the strategy: keep scans out of the
hot working set.
Sourcepub fn insert_with(
&self,
key: K,
value: V,
strategy: BufferAccessStrategy,
) -> Option<(K, V)>
pub fn insert_with( &self, key: K, value: V, strategy: BufferAccessStrategy, ) -> Option<(K, V)>
Strategy-aware insert.
Normal behaves exactly like PageCache::insert. Non-Normal
strategies route the write into the dedicated ring instead of
the main pool. The ring’s eviction return is propagated up so
callers (the pager) can flush dirty pages through the
double-write buffer.
Sourcepub fn clear_strategy_rings(&self)
pub fn clear_strategy_rings(&self)
Drop every strategy ring. Used by tests and by post-checkpoint cleanup.
Sourcepub fn mark_dirty(&self, key: &K) -> bool
pub fn mark_dirty(&self, key: &K) -> bool
Mark a page as dirty
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get statistics
Sourcepub fn config(&self) -> &CacheConfig
pub fn config(&self) -> &CacheConfig
Get configuration
Sourcepub fn dirty_count(&self) -> usize
pub fn dirty_count(&self) -> usize
Get dirty page count
Auto Trait Implementations§
impl<K, V, W = NoOpWriter> !Freeze for PageCache<K, V, W>
impl<K, V, W> RefUnwindSafe for PageCache<K, V, W>where
W: RefUnwindSafe,
impl<K, V, W> Send for PageCache<K, V, W>
impl<K, V, W> Sync for PageCache<K, V, W>
impl<K, V, W> Unpin for PageCache<K, V, W>
impl<K, V, W> UnsafeUnpin for PageCache<K, V, W>where
W: UnsafeUnpin,
impl<K, V, W> UnwindSafe for PageCache<K, V, W>where
W: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request