pub struct CacheRateLimitStorage { /* private fields */ }Expand description
Shared fixed-window counter backed by the application’s existing cache. Every attempt increments, including blocked attempts; retries report the full window.
Implementations§
Source§impl CacheRateLimitStorage
impl CacheRateLimitStorage
pub fn new(cache: Arc<dyn CacheAdapter>) -> Self
Trait Implementations§
Source§impl Debug for CacheRateLimitStorage
impl Debug for CacheRateLimitStorage
Source§impl RateLimitStorage for CacheRateLimitStorage
impl RateLimitStorage for CacheRateLimitStorage
fn consume<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
rule: &'life2 EndpointRateLimit,
) -> Pin<Box<dyn Future<Output = AuthResult<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn observe_window(&self, _window_seconds: f64)
fn observe_window(&self, _window_seconds: f64)
Publish configured windows before serving requests, so persistent
storage can prune without retiring a longer-lived configured quota.
Auto Trait Implementations§
impl !RefUnwindSafe for CacheRateLimitStorage
impl !UnwindSafe for CacheRateLimitStorage
impl Freeze for CacheRateLimitStorage
impl Send for CacheRateLimitStorage
impl Sync for CacheRateLimitStorage
impl Unpin for CacheRateLimitStorage
impl UnsafeUnpin for CacheRateLimitStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more