pub struct Store<K, V, S, P>{ /* private fields */ }Expand description
The disk cache engine that serves as the storage backend of foyer.
Implementations§
Source§impl<K, V, S, P> Store<K, V, S, P>
impl<K, V, S, P> Store<K, V, S, P>
Sourcepub async fn close(&self) -> Result<()>
pub async fn close(&self) -> Result<()>
Close the disk cache gracefully.
close will wait for all ongoing flush and reclaim tasks to finish.
Sourcepub fn filter(&self, hash: u64, estimated_size: usize) -> StorageFilterResult
pub fn filter(&self, hash: u64, estimated_size: usize) -> StorageFilterResult
Return if the given key can be picked by the admission filter.
Sourcepub fn enqueue(&self, piece: Piece<K, V, P>, force: bool)
pub fn enqueue(&self, piece: Piece<K, V, P>, force: bool)
Push a in-memory cache piece to the disk cache write queue.
Sourcepub async fn load<Q>(&self, key: &Q) -> Result<Load<K, V, P>>
pub async fn load<Q>(&self, key: &Q) -> Result<Load<K, V, P>>
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 statistics(&self) -> &Arc<Statistics>
pub fn statistics(&self) -> &Arc<Statistics>
Get the statistics information of the disk cache.
Sourcepub fn entry_estimated_size(&self, key: &K, value: &V) -> usize
pub fn entry_estimated_size(&self, key: &K, value: &V) -> usize
Return the estimated serialized size of the entry.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
If the disk cache is enabled.
Trait Implementations§
Auto Trait Implementations§
impl<K, V, S, P> Freeze for Store<K, V, S, P>
impl<K, V, S, P> !RefUnwindSafe for Store<K, V, S, P>
impl<K, V, S, P> Send for Store<K, V, S, P>
impl<K, V, S, P> Sync for Store<K, V, S, P>
impl<K, V, S, P> Unpin for Store<K, V, S, P>
impl<K, V, S, P> !UnwindSafe for Store<K, V, S, P>
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§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