pub struct RedisConnection { /* private fields */ }
Expand description

A wrapper type for making the redis crate compatible with namespacing.

Implementations§

source§

impl RedisConnection

source

pub fn new(connection: Connection) -> Self

source

pub fn set_namespace(&mut self, namespace: String)

source

pub fn with_namespace(self, namespace: String) -> Self

source

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
    }
source

pub async fn brpop( &mut self, keys: Vec<String>, timeout: usize ) -> Result<Option<(String, String)>, RedisError>

source

pub fn cmd_with_key(&mut self, cmd: &str, key: String) -> Cmd

source

pub async fn del(&mut self, key: String) -> Result<usize, RedisError>

source

pub async fn expire( &mut self, key: String, value: usize ) -> Result<usize, RedisError>

source

pub async fn lpush( &mut self, key: String, value: String ) -> Result<(), RedisError>

source

pub async fn sadd( &mut self, key: String, value: String ) -> Result<(), RedisError>

source

pub async fn set_nx_ex( &mut self, key: String, value: String, ttl_in_seconds: usize ) -> Result<RedisValue, RedisError>

source

pub async fn zrange( &mut self, key: String, lower: isize, upper: isize ) -> Result<Vec<String>, RedisError>

source

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>

source

pub async fn zadd<V: ToRedisArgs + Send + Sync, S: ToRedisArgs + Send + Sync>( &mut self, key: String, value: V, score: S ) -> Result<usize, RedisError>

source

pub async fn zadd_ch<V: ToRedisArgs + Send + Sync, S: ToRedisArgs + Send + Sync>( &mut self, key: String, value: V, score: S ) -> Result<bool, RedisError>

source

pub async fn zrem( &mut self, key: String, value: String ) -> Result<bool, RedisError>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more