pub struct Store<K, V, S = RandomState>{ /* private fields */ }Expand description
The disk cache engine that serves as the storage backend of foyer.
Implementations§
source§impl<K, V, S> Store<K, V, S>
impl<K, V, S> Store<K, V, S>
sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Close the disk cache gracefully.
close will wait for all ongoing flush and reclaim tasks to finish.
sourcepub fn pick(&self, key: &K) -> bool
pub fn pick(&self, key: &K) -> bool
Return if the given key can be picked by the admission picker.
sourcepub fn enqueue(&self, entry: CacheEntry<K, V, S>, force: bool)
pub fn enqueue(&self, entry: CacheEntry<K, V, S>, force: bool)
Push a in-memory cache entry to the disk cache write queue.
sourcepub async fn load<Q>(&self, key: &Q) -> Result<Option<(K, V)>, Error>
pub async fn load<Q>(&self, key: &Q) -> Result<Option<(K, V)>, Error>
Load a cache entry from the disk cache.
sourcepub fn delete<'a, Q>(&'a self, key: &'a Q)
pub fn delete<'a, Q>(&'a self, key: &'a Q)
Delete the cache entry with the given key from the disk cache.
sourcepub fn may_contains<Q>(&self, key: &Q) -> bool
pub fn may_contains<Q>(&self, key: &Q) -> bool
Check if the disk cache contains a cached entry with the given key.
contains may return a false-positive result if there is a hash collision with the given key.
sourcepub fn stats(&self) -> Arc<DeviceStats>
pub fn stats(&self) -> Arc<DeviceStats>
Get the statistics information of the disk cache.
Trait Implementations§
Auto Trait Implementations§
impl<K, V, S> Freeze for Store<K, V, S>
impl<K, V, S = RandomState> !RefUnwindSafe for Store<K, V, S>
impl<K, V, S> Send for Store<K, V, S>
impl<K, V, S> Sync for Store<K, V, S>
impl<K, V, S> Unpin for Store<K, V, S>
impl<K, V, S = RandomState> !UnwindSafe for Store<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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