pub struct RedisCache { /* private fields */ }Expand description
Redis distributed cache with ConnectionManager for automatic reconnection
Implementations§
Source§impl RedisCache
impl RedisCache
Sourcepub async fn new() -> CacheResult<Self>
pub async fn new() -> CacheResult<Self>
Sourcepub async fn with_url(redis_url: &str) -> CacheResult<Self>
pub async fn with_url(redis_url: &str) -> CacheResult<Self>
Create new Redis cache with custom URL
§Errors
Returns an error if the Redis URL is invalid or connection fails.
Sourcepub async fn remove_bulk(&self, keys: &[String]) -> CacheResult<usize>
pub async fn remove_bulk(&self, keys: &[String]) -> CacheResult<usize>
Trait Implementations§
Source§impl CacheBackend for RedisCache
Implement CacheBackend trait for RedisCache
impl CacheBackend for RedisCache
Implement CacheBackend trait for RedisCache
Source§fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
Get value from cache by key Read more
Source§fn set_with_ttl<'a>(
&'a self,
key: &'a str,
value: Bytes,
ttl: Duration,
) -> BoxFuture<'a, CacheResult<()>>
fn set_with_ttl<'a>( &'a self, key: &'a str, value: Bytes, ttl: Duration, ) -> BoxFuture<'a, CacheResult<()>>
Set value in cache with time-to-live Read more
Source§fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, CacheResult<()>>
fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, CacheResult<()>>
Remove value from cache Read more
Source§fn remove_pattern<'a>(
&'a self,
pattern: &'a str,
) -> BoxFuture<'a, CacheResult<()>>
fn remove_pattern<'a>( &'a self, pattern: &'a str, ) -> BoxFuture<'a, CacheResult<()>>
Remove keys matching a pattern Read more
Source§impl L2CacheBackend for RedisCache
impl L2CacheBackend for RedisCache
Auto Trait Implementations§
impl Freeze for RedisCache
impl !RefUnwindSafe for RedisCache
impl Send for RedisCache
impl Sync for RedisCache
impl Unpin for RedisCache
impl UnsafeUnpin for RedisCache
impl !UnwindSafe for RedisCache
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