Struct sidekiq::RedisConnection
source · 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69
async fn perform(&self, args: PaymentReportArgs) -> Result<()> {
use redis::AsyncCommands;
let times_called: usize = self
.redis
.get()
.await?
.unnamespaced_borrow_mut()
.incr("example_of_accessing_the_raw_redis_connection", 1)
.await?;
debug!({ "times_called" = times_called }, "Called this worker");
self.send_report(args.user_guid).await
}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( &mut self, key: String, value: String ) -> Result<(), RedisError>
pub async fn sadd( &mut self, key: String, value: String ) -> Result<(), RedisError>
pub async fn set_nx_ex( &mut self, key: String, value: String, 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( &mut self, key: String, value: String ) -> Result<bool, RedisError>
Auto Trait Implementations§
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