pub struct SingleFlightCache<V> { /* private fields */ }Implementations§
Source§impl<V: Clone + Send + Sync + 'static> SingleFlightCache<V>
impl<V: Clone + Send + Sync + 'static> SingleFlightCache<V>
pub fn new(capacity: usize) -> Self
pub async fn get(&self, key: &str) -> Option<CacheLookup<V>>
pub async fn insert( &self, key: impl Into<String>, value: V, ttl: Duration, stale_window: Duration, ) -> Result<(), CacheError>
pub async fn invalidate(&self, key: &str)
pub async fn len(&self) -> usize
pub async fn is_empty(&self) -> bool
pub async fn get_or_compute<F, Fut>( &self, key: impl Into<String>, ttl: Duration, stale_window: Duration, producer: F, ) -> Result<V, CacheError>
Trait Implementations§
Source§impl<V: Clone> Clone for SingleFlightCache<V>
impl<V: Clone> Clone for SingleFlightCache<V>
Source§fn clone(&self) -> SingleFlightCache<V>
fn clone(&self) -> SingleFlightCache<V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<V> !RefUnwindSafe for SingleFlightCache<V>
impl<V> !UnwindSafe for SingleFlightCache<V>
impl<V> Freeze for SingleFlightCache<V>
impl<V> Send for SingleFlightCache<V>where
V: Send,
impl<V> Sync for SingleFlightCache<V>where
V: Send,
impl<V> Unpin for SingleFlightCache<V>
impl<V> UnsafeUnpin for SingleFlightCache<V>
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