pub struct RedisCounterStore {
client: Arc<RedisStoreClient>,
store_name: String,
metrics: Option<Arc<GatewayMetrics>>,
script: Script,
}Fields§
§client: Arc<RedisStoreClient>§store_name: String§metrics: Option<Arc<GatewayMetrics>>§script: ScriptImplementations§
Source§impl RedisCounterStore
impl RedisCounterStore
pub fn new( client: Arc<RedisStoreClient>, store_name: String, metrics: Option<Arc<GatewayMetrics>>, ) -> Self
fn backend_err(&self, msg: String) -> CounterError
Trait Implementations§
Source§impl CounterStore for RedisCounterStore
impl CounterStore for RedisCounterStore
Source§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,
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.Auto Trait Implementations§
impl !RefUnwindSafe for RedisCounterStore
impl !UnwindSafe for RedisCounterStore
impl Freeze for RedisCounterStore
impl Send for RedisCounterStore
impl Sync for RedisCounterStore
impl Unpin for RedisCounterStore
impl UnsafeUnpin for RedisCounterStore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more