Struct matrix_sdk::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>
e2e-encryption
only.pub fn with_settings(max_delay: Duration, multiplier: u8) -> FailuresCache<T>
e2e-encryption
only.sourcepub fn contains<Q>(&self, key: &Q) -> bool
Available on crate feature e2e-encryption
only.
pub fn contains<Q>(&self, key: &Q) -> bool
e2e-encryption
only.Is the given key non-expired and part of the cache.
sourcepub fn failure_count<Q>(&self, key: &Q) -> Option<u8>
Available on crate feature e2e-encryption
only.
pub fn failure_count<Q>(&self, key: &Q) -> Option<u8>
e2e-encryption
only.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 insert(&self, item: T)
Available on crate feature e2e-encryption
only.
pub fn insert(&self, item: T)
e2e-encryption
only.Add a single item to the cache.
sourcepub fn extend(&self, iterator: impl IntoIterator<Item = T>)
Available on crate feature e2e-encryption
only.
pub fn extend(&self, iterator: impl IntoIterator<Item = T>)
e2e-encryption
only.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>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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