pub struct RedisConnection { /* private fields */ }
Expand description
A wrapper type for making the redis crate compatible with namespacing.
Implementations§
Source§impl RedisConnection
impl RedisConnection
pub fn new(connection: Connection) -> Self
pub fn set_namespace(&mut self, namespace: String)
pub fn with_namespace(self, namespace: String) -> Self
Sourcepub fn unnamespaced_borrow_mut(&mut self) -> &mut Connection
pub fn unnamespaced_borrow_mut(&mut self) -> &mut Connection
This allows you to borrow the raw redis connection without any namespacing support.
Examples found in repository?
examples/demo.rs (line 62)
55 async fn perform(&self, args: PaymentReportArgs) -> Result<()> {
56 use redis::AsyncCommands;
57
58 let times_called: usize = self
59 .redis
60 .get()
61 .await?
62 .unnamespaced_borrow_mut()
63 .incr("example_of_accessing_the_raw_redis_connection", 1)
64 .await?;
65
66 debug!({ "times_called" = times_called }, "Called this worker");
67
68 self.send_report(args.user_guid).await
69 }
pub async fn brpop( &mut self, keys: Vec<String>, timeout: usize, ) -> Result<Option<(String, String)>, RedisError>
pub fn cmd_with_key(&mut self, cmd: &str, key: String) -> Cmd
pub async fn del(&mut self, key: String) -> Result<usize, RedisError>
pub async fn expire( &mut self, key: String, value: usize, ) -> Result<usize, RedisError>
pub async fn lpush<V>( &mut self, key: String, value: V, ) -> Result<(), RedisError>
pub async fn sadd<V>(&mut self, key: String, value: V) -> Result<(), RedisError>
pub async fn set_nx_ex<V>( &mut self, key: String, value: V, ttl_in_seconds: usize, ) -> Result<RedisValue, RedisError>
pub async fn zrange( &mut self, key: String, lower: isize, upper: isize, ) -> Result<Vec<String>, RedisError>
pub async fn zrangebyscore_limit<L: ToRedisArgs + Send + Sync, U: ToRedisArgs + Sync + Send>( &mut self, key: String, lower: L, upper: U, offset: isize, limit: isize, ) -> Result<Vec<String>, RedisError>
pub async fn zadd<V: ToRedisArgs + Send + Sync, S: ToRedisArgs + Send + Sync>( &mut self, key: String, value: V, score: S, ) -> Result<usize, RedisError>
pub async fn zadd_ch<V: ToRedisArgs + Send + Sync, S: ToRedisArgs + Send + Sync>( &mut self, key: String, value: V, score: S, ) -> Result<bool, RedisError>
pub async fn zrem<V>( &mut self, key: String, value: V, ) -> Result<usize, RedisError>
Auto 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