Struct foyer::HybridCacheStorageWriter
source · pub struct HybridCacheStorageWriter<K, V, S = RandomState>{ /* private fields */ }Expand description
Writer for disk cache of a hybrid cache to support more flexible write APIs.
Implementations§
source§impl<K, V, S> HybridCacheStorageWriter<K, V, S>
impl<K, V, S> HybridCacheStorageWriter<K, V, S>
sourcepub fn pick(&mut self) -> bool
pub fn pick(&mut self) -> bool
Check if the entry can be admitted by the admission picker of the disk cache.
pick is idempotent (unless force is called). Which means the disk cache only check its admission at most
once.
sourcepub fn insert(self, value: V) -> Option<HybridCacheEntry<K, V, S>>
pub fn insert(self, value: V) -> Option<HybridCacheEntry<K, V, S>>
Insert the entry to the disk cache only.
sourcepub fn insert_with_context(
self,
value: V,
context: CacheContext,
) -> Option<HybridCacheEntry<K, V, S>>
pub fn insert_with_context( self, value: V, context: CacheContext, ) -> Option<HybridCacheEntry<K, V, S>>
Insert the entry with context to the disk cache only.
Auto Trait Implementations§
impl<K, V, S> Freeze for HybridCacheStorageWriter<K, V, S>where
K: Freeze,
impl<K, V, S = RandomState> !RefUnwindSafe for HybridCacheStorageWriter<K, V, S>
impl<K, V, S> Send for HybridCacheStorageWriter<K, V, S>
impl<K, V, S> Sync for HybridCacheStorageWriter<K, V, S>
impl<K, V, S> Unpin for HybridCacheStorageWriter<K, V, S>where
K: Unpin,
impl<K, V, S = RandomState> !UnwindSafe for HybridCacheStorageWriter<K, V, S>
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