pub struct RedisRateLimitCounter { /* private fields */ }Expand description
Redis-backed RateLimitCounter.
Counters live at aa:ratelimit:<key>. Cheap to Clone — clones share
the underlying Pool.
Implementations§
Trait Implementations§
Source§impl Clone for RedisRateLimitCounter
impl Clone for RedisRateLimitCounter
Source§fn clone(&self) -> RedisRateLimitCounter
fn clone(&self) -> RedisRateLimitCounter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl RateLimitCounter for RedisRateLimitCounter
impl RateLimitCounter for RedisRateLimitCounter
Source§fn increment<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
amount: u64,
window_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn increment<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
amount: u64,
window_secs: u64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically add
amount to the counter for key within the window of
length window_secs, returning the new total for the current window. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RedisRateLimitCounter
impl !UnwindSafe for RedisRateLimitCounter
impl Freeze for RedisRateLimitCounter
impl Send for RedisRateLimitCounter
impl Sync for RedisRateLimitCounter
impl Unpin for RedisRateLimitCounter
impl UnsafeUnpin for RedisRateLimitCounter
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