pub enum BackendFailureMode {
L1Only,
Error,
Retry {
attempts: u8,
},
}Expand description
Behaviour when an L2 backend operation fails.
Defaults to BackendFailureMode::L1Only — the most permissive
mode, suitable for caches that are an optimisation rather than a
correctness boundary. Consumers with stricter consistency
requirements should pick BackendFailureMode::Error (propagate)
or BackendFailureMode::Retry (retry-with-backoff before falling
through). The policy applies to operations that actually touch the backend:
insert, get_async, and invalidate. Fetch and refresh helpers apply
fetched values to the in-process L1 map and do not write those values through
to L2.
Variants§
L1Only
Log the backend error, fall back to L1-only. Insert / get / invalidate succeed against L1 even if the backend is unreachable. The recommended default.
Error
Propagate the backend error to the caller.
insert returns Err(InsertError::BackendFailed(...)),
get_async and invalidate return Err(BackendError). Use
when those backend-touching operations should treat L2 as a
correctness requirement, not an optimisation.
Retry
Retry the backend operation up to attempts total attempts
(including the original call) before falling through to
L1Only behaviour for retryable errors. Backoff uses an internal
capped exponential schedule plus 0-25% jitter in production call
paths. attempts must be at least 1.
Trait Implementations§
Source§impl Clone for BackendFailureMode
impl Clone for BackendFailureMode
Source§fn clone(&self) -> BackendFailureMode
fn clone(&self) -> BackendFailureMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BackendFailureMode
impl Debug for BackendFailureMode
Source§impl PartialEq for BackendFailureMode
impl PartialEq for BackendFailureMode
Source§fn eq(&self, other: &BackendFailureMode) -> bool
fn eq(&self, other: &BackendFailureMode) -> bool
self and other values to be equal, and is used by ==.impl Copy for BackendFailureMode
impl Eq for BackendFailureMode
impl StructuralPartialEq for BackendFailureMode
Auto Trait Implementations§
impl Freeze for BackendFailureMode
impl RefUnwindSafe for BackendFailureMode
impl Send for BackendFailureMode
impl Sync for BackendFailureMode
impl Unpin for BackendFailureMode
impl UnsafeUnpin for BackendFailureMode
impl UnwindSafe for BackendFailureMode
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.