pub struct IdempotencyCache { /* private fields */ }Implementations§
Source§impl IdempotencyCache
impl IdempotencyCache
pub fn new() -> Self
Sourcepub fn check(&mut self, env: &Envelope, now_ms: i64) -> bool
pub fn check(&mut self, env: &Envelope, now_ms: i64) -> bool
Returns true if this is the FIRST time we accept this message.
A duplicate (same msg_id, same fingerprint, still within TTL) is
rejected — the caller MUST NOT re-process it, but SHOULD re-send the
cached response if it has one.
A same-msg_id message with a DIFFERENT fingerprint is a protocol
violation: also rejected, and should be logged as an error.
Sourcepub fn evict_older_than(&mut self, now_ms: i64, ttl_ms: i64)
pub fn evict_older_than(&mut self, now_ms: i64, ttl_ms: i64)
Evict entries older than ttl_ms (call periodically).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for IdempotencyCache
impl Debug for IdempotencyCache
Source§impl Default for IdempotencyCache
impl Default for IdempotencyCache
Source§fn default() -> IdempotencyCache
fn default() -> IdempotencyCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IdempotencyCache
impl RefUnwindSafe for IdempotencyCache
impl Send for IdempotencyCache
impl Sync for IdempotencyCache
impl Unpin for IdempotencyCache
impl UnsafeUnpin for IdempotencyCache
impl UnwindSafe for IdempotencyCache
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