pub struct RedisBackend { /* private fields */ }Expand description
Redis-backed storage for multi-node deployments.
Implementations§
Source§impl RedisBackend
impl RedisBackend
Sourcepub async fn connect(url: impl AsRef<str>) -> Result<Self, BackendError>
pub async fn connect(url: impl AsRef<str>) -> Result<Self, BackendError>
Connects to Redis using the provided URL.
Sourcepub async fn connect_with_namespace(
url: impl AsRef<str>,
namespace: impl Into<Arc<str>>,
) -> Result<Self, BackendError>
pub async fn connect_with_namespace( url: impl AsRef<str>, namespace: impl Into<Arc<str>>, ) -> Result<Self, BackendError>
Connects to Redis and sets a custom namespace.
Trait Implementations§
Source§impl Clone for RedisBackend
impl Clone for RedisBackend
Source§fn clone(&self) -> RedisBackend
fn clone(&self) -> RedisBackend
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 RateLimitBackend for RedisBackend
impl RateLimitBackend for RedisBackend
Source§type Error = BackendError
type Error = BackendError
Error type returned by this backend.
Source§fn transact<'life0, 'life1, 'async_trait, P>(
&'life0 self,
storage_key: &'life1 str,
quota: Quota,
now_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitSnapshot, Self::Error>> + Send + 'async_trait>>where
P: RateLimitPolicy + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transact<'life0, 'life1, 'async_trait, P>(
&'life0 self,
storage_key: &'life1 str,
quota: Quota,
now_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitSnapshot, Self::Error>> + Send + 'async_trait>>where
P: RateLimitPolicy + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically loads policy state, applies the rate limit algorithm, and persists the result.
Auto Trait Implementations§
impl !RefUnwindSafe for RedisBackend
impl !UnwindSafe for RedisBackend
impl Freeze for RedisBackend
impl Send for RedisBackend
impl Sync for RedisBackend
impl Unpin for RedisBackend
impl UnsafeUnpin for RedisBackend
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