pub struct InMemoryRateLimitStore { /* private fields */ }Expand description
In-memory rate-limit store intended for local development and single-process apps.
The store tracks counters in process memory and opportunistically removes
expired identity windows during RateLimitStore::check, scanning at most
once per window duration so a large identity set does not add a full-map
sweep to every request. Rate-limit decisions never depend on that sweep:
each identity’s window resets itself on its next check. The store is not
shared across processes, not durable across restarts, and not a substitute
for a distributed limiter at multi-instance production boundaries.
Implementations§
Source§impl InMemoryRateLimitStore
impl InMemoryRateLimitStore
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of identity windows currently retained by the store.
Expired windows are pruned opportunistically during
RateLimitStore::check (at most one full sweep per window duration),
so this value is mainly useful for tests, diagnostics, and local tools.
Trait Implementations§
Source§impl Clone for InMemoryRateLimitStore
impl Clone for InMemoryRateLimitStore
Source§fn clone(&self) -> InMemoryRateLimitStore
fn clone(&self) -> InMemoryRateLimitStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more