pub struct RedisConnection { /* private fields */ }Expand description
Represents a Redis connection (placeholder for actual implementation).
In a real implementation, this would use redis-rs or fred crate.
Implementations§
Source§impl RedisConnection
impl RedisConnection
Sourcepub async fn new(config: RedisCacheConfig) -> CacheResult<Self>
pub async fn new(config: RedisCacheConfig) -> CacheResult<Self>
Create a new connection.
Sourcepub fn config(&self) -> &RedisCacheConfig
pub fn config(&self) -> &RedisCacheConfig
Get the config.
Sourcepub async fn set(
&self,
key: &str,
value: &[u8],
ttl: Option<Duration>,
) -> CacheResult<()>
pub async fn set( &self, key: &str, value: &[u8], ttl: Option<Duration>, ) -> CacheResult<()>
SET command with optional TTL.
Sourcepub async fn del(&self, key: &str) -> CacheResult<bool>
pub async fn del(&self, key: &str) -> CacheResult<bool>
DEL command.
Sourcepub async fn exists(&self, key: &str) -> CacheResult<bool>
pub async fn exists(&self, key: &str) -> CacheResult<bool>
EXISTS command.
Sourcepub async fn keys(&self, pattern: &str) -> CacheResult<Vec<String>>
pub async fn keys(&self, pattern: &str) -> CacheResult<Vec<String>>
KEYS command (use SCAN in production).
Sourcepub async fn flush(&self) -> CacheResult<()>
pub async fn flush(&self) -> CacheResult<()>
FLUSHDB command.
Sourcepub async fn dbsize(&self) -> CacheResult<usize>
pub async fn dbsize(&self) -> CacheResult<usize>
DBSIZE command.
Sourcepub async fn info(&self) -> CacheResult<String>
pub async fn info(&self) -> CacheResult<String>
INFO command.
Trait Implementations§
Source§impl Clone for RedisConnection
impl Clone for RedisConnection
Source§fn clone(&self) -> RedisConnection
fn clone(&self) -> RedisConnection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RedisConnection
impl RefUnwindSafe for RedisConnection
impl Send for RedisConnection
impl Sync for RedisConnection
impl Unpin for RedisConnection
impl UnwindSafe for RedisConnection
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