pub trait CounterStore: Send + Sync {
// Required method
fn incr_fixed_window<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u64,
window: Duration,
) -> Pin<Box<dyn Future<Output = Result<WindowResult, CounterError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A backend that counts requests per key within fixed time windows.
Required Methods§
Sourcefn incr_fixed_window<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u64,
window: Duration,
) -> Pin<Box<dyn Future<Output = Result<WindowResult, CounterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn incr_fixed_window<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
limit: u64,
window: Duration,
) -> Pin<Box<dyn Future<Output = Result<WindowResult, CounterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically counts one request for key in the current fixed window
of length window, allowing up to limit requests per window.