Skip to main content

Crate runlimit_memory

Crate runlimit_memory 

Source
Expand description

Hard-bounded, process-local rate-limit storage.

MemoryStore implements the same anchored fixed-window model as the PostgreSQL backend. GcraStore implements a continuously replenished generic-cell-rate-algorithm model for process-local use. Both stores deliberately refuse to evict live entries. When a shard is full, a new subject is denied until bounded cleanup frees space. An atomic batch that can never fit in one shard returns a structural MemoryStoreError instead of a retryable capacity denial. Both stores implement runlimit_core::Limiter for async generic adapters while retaining their synchronous inherent check methods.

The optional serde feature enables validated MemoryStoreConfig loading, read-only MemoryStoreStats serialization, and the corresponding runlimit-core metadata feature.

Structs§

GcraStore
A hard-bounded, process-local generic-cell-rate-algorithm store.
MemoryStore
A sharded, hard-bounded, process-local fixed-window store.
MemoryStoreConfig
Configuration for a hard-bounded MemoryStore.
MemoryStoreStats
Current bounded-store usage.
SystemClock
A monotonic clock backed by Instant.

Enums§

MemoryStoreConfigError
Invalid in-memory store configuration.
MemoryStoreError
A fail-closed in-memory store error.

Traits§

Clock
Supplies monotonic elapsed time to a MemoryStore.