pub struct Deduplicator { /* private fields */ }Expand description
Deduplicates requests by key within a TTL window.
§Guarantees
- Deterministic: same key always maps to the same result
- Thread-safe via
Arc<Mutex<_>> - Entries expire after
ttl
Implementations§
Source§impl Deduplicator
impl Deduplicator
Sourcepub fn check_and_register(
&self,
key: &str,
) -> Result<DeduplicationResult, AgentRuntimeError>
pub fn check_and_register( &self, key: &str, ) -> Result<DeduplicationResult, AgentRuntimeError>
Check whether key is new, cached, or in-flight.
Marks the key as in-flight if it is new.
Trait Implementations§
Source§impl Clone for Deduplicator
impl Clone for Deduplicator
Source§fn clone(&self) -> Deduplicator
fn clone(&self) -> Deduplicator
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for Deduplicator
impl RefUnwindSafe for Deduplicator
impl Send for Deduplicator
impl Sync for Deduplicator
impl Unpin for Deduplicator
impl UnsafeUnpin for Deduplicator
impl UnwindSafe for Deduplicator
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