pub trait ThrottleStore:
Send
+ Sync
+ 'static {
// Required methods
fn incr(&self, key: String, ttl: Duration) -> BoxFuture<'_, Result<u64>>;
fn count(&self, key: String) -> BoxFuture<'_, Result<u64>>;
}Expand description
A backend that counts requests per key within a time window.
The throttler buckets each key by window and asks the store to count hits.
An in-memory store (MemoryThrottleStore) suits a single instance; a Redis
store (behind the redis feature) shares the count across instances.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".