pub struct MemoryIdempotencyStore { /* private fields */ }Expand description
In-memory idempotency cache.
Implementations§
Source§impl MemoryIdempotencyStore
impl MemoryIdempotencyStore
pub fn new() -> MemoryIdempotencyStore
Sourcepub fn with_inflight_ttl(self, ttl: Duration) -> MemoryIdempotencyStore
pub fn with_inflight_ttl(self, ttl: Duration) -> MemoryIdempotencyStore
Override the TTL used for in-flight begin entries. Default 300s.
Set this to be at least as long as the slowest handler that may
register an idempotency key — anything shorter risks an in-flight
entry expiring before the handler completes, breaking coalescing.
Trait Implementations§
Source§impl Clone for MemoryIdempotencyStore
impl Clone for MemoryIdempotencyStore
Source§fn clone(&self) -> MemoryIdempotencyStore
fn clone(&self) -> MemoryIdempotencyStore
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 moreSource§impl Default for MemoryIdempotencyStore
impl Default for MemoryIdempotencyStore
Source§fn default() -> MemoryIdempotencyStore
fn default() -> MemoryIdempotencyStore
Returns the “default value” for a type. Read more
Source§impl IdempotencyStore for MemoryIdempotencyStore
impl IdempotencyStore for MemoryIdempotencyStore
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<IdempotencyEntry>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<IdempotencyEntry>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
Reads an existing entry for
key.Source§fn begin<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
payload_sig: [u8; 20],
) -> Pin<Box<dyn Future<Output = IdempotencyEntry> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
fn begin<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
payload_sig: [u8; 20],
) -> Pin<Box<dyn Future<Output = IdempotencyEntry> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
Marks
key as in-flight; returns the freshly inserted record, or the
existing one if another request arrived first.Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
entry: IdempotencyEntry,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
entry: IdempotencyEntry,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
Persists a completed entry with the configured TTL.
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryIdempotencyStore: 'async_trait,
Removes the entry — typically invoked when the handler decided not to
cache the result (e.g. opt-out via response header).
Auto Trait Implementations§
impl Freeze for MemoryIdempotencyStore
impl RefUnwindSafe for MemoryIdempotencyStore
impl Send for MemoryIdempotencyStore
impl Sync for MemoryIdempotencyStore
impl Unpin for MemoryIdempotencyStore
impl UnsafeUnpin for MemoryIdempotencyStore
impl UnwindSafe for MemoryIdempotencyStore
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> 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> 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