Skip to main content

SlidingWindowStore

Trait SlidingWindowStore 

Source
pub trait SlidingWindowStore: Send + Sync {
    // Required method
    fn record_hit(
        &self,
        key: &str,
        now: f64,
        window: u64,
    ) -> Result<u64, StoreError>;
}
Expand description

The reference rate-limit window operations, one hit per call.

Required Methods§

Source

fn record_hit( &self, key: &str, now: f64, window: u64, ) -> Result<u64, StoreError>

Record one hit at now into the window key and return the post-eviction ZCARD count. The four reference operations run atomically (one transaction).

§Errors

StoreError when the backend call fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§