pub struct TieredBlockCache { /* private fields */ }Expand description
Multi-level cache with hot (L1) and warm (L2) tiers
L1 is smaller and faster, L2 is larger but may have more contention
Implementations§
Source§impl TieredBlockCache
impl TieredBlockCache
Sourcepub fn new(l1_capacity: usize, l2_capacity: usize) -> Self
pub fn new(l1_capacity: usize, l2_capacity: usize) -> Self
Create a new tiered cache
§Arguments
l1_capacity- Capacity of L1 (hot) cache in number of blocksl2_capacity- Capacity of L2 (warm) cache in number of blocks
Sourcepub fn get(&self, cid: &Cid) -> Option<Block>
pub fn get(&self, cid: &Cid) -> Option<Block>
Get a block from cache (checks L1 first, then L2)
Sourcepub fn stats(&self) -> TieredCacheStats
pub fn stats(&self) -> TieredCacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for TieredBlockCache
impl !RefUnwindSafe for TieredBlockCache
impl Send for TieredBlockCache
impl Sync for TieredBlockCache
impl Unpin for TieredBlockCache
impl !UnwindSafe for TieredBlockCache
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
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>
Converts
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>
Converts
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 more