Struct matrix_sdk_base::failures_cache::FailuresCache
source · pub struct FailuresCache<T>{ /* private fields */ }
Expand description
A TTL cache where items get inactive instead of discarded.
The items need to be explicitly removed from the cache. This allows us to implement exponential backoff based TTL.
Implementations§
source§impl<T> FailuresCache<T>
impl<T> FailuresCache<T>
pub fn new() -> FailuresCache<T>
pub fn with_settings(max_delay: Duration, multiplier: u8) -> FailuresCache<T>
sourcepub fn failure_count<Q>(&self, key: &Q) -> Option<u8>
pub fn failure_count<Q>(&self, key: &Q) -> Option<u8>
Get the failure count for a given key.
§Returns
-
None
if this key is not in the failure cache. (It has never failed, or it has beenFailuresCache::remove()
d since the last failure.) -
Some(u8)
: the number of times it has failed since it was first added to the failure cache. (In other words, one less than the total number of failures.)
sourcepub fn extend(&self, iterator: impl IntoIterator<Item = T>)
pub fn extend(&self, iterator: impl IntoIterator<Item = T>)
Extend the cache with the given iterator of items.
Items that are already part of the cache, whether they are expired or not, will have their TTL extended using an exponential backoff algorithm.
Trait Implementations§
source§impl<T> Clone for FailuresCache<T>
impl<T> Clone for FailuresCache<T>
source§fn clone(&self) -> FailuresCache<T>
fn clone(&self) -> FailuresCache<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Debug for FailuresCache<T>
impl<T> Debug for FailuresCache<T>
Auto Trait Implementations§
impl<T> Freeze for FailuresCache<T>
impl<T> RefUnwindSafe for FailuresCache<T>
impl<T> Send for FailuresCache<T>
impl<T> Sync for FailuresCache<T>
impl<T> Unpin for FailuresCache<T>
impl<T> UnwindSafe for FailuresCache<T>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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