pub struct TieredBlockCache { /* private fields */ }Expand description
Multi-level in-process cache with hot (L1) and warm (L2) tiers.
L1 is smaller and faster. L2 catches blocks evicted from L1.
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.
l1_capacity— capacity of the hot tier (number of blocks).l2_capacity— capacity of the warm tier (number of blocks).
Sourcepub fn get(&self, cid: &Cid) -> Option<Block>
pub fn get(&self, cid: &Cid) -> Option<Block>
Get a block — checks L1 then L2; promotes L2 hits to L1.
Sourcepub fn stats(&self) -> TieredCacheStats
pub fn stats(&self) -> TieredCacheStats
Return a statistics snapshot.
Auto Trait Implementations§
impl !RefUnwindSafe for TieredBlockCache
impl !UnwindSafe for TieredBlockCache
impl Freeze for TieredBlockCache
impl Send for TieredBlockCache
impl Sync for TieredBlockCache
impl Unpin for TieredBlockCache
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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