Struct RedisConnection

Source
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    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    }
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<V>( &mut self, key: String, value: V, ) -> Result<(), RedisError>
where V: ToRedisArgs + Send + Sync,

Source

pub async fn sadd<V>(&mut self, key: String, value: V) -> Result<(), RedisError>
where V: ToRedisArgs + Send + Sync,

Source

pub async fn set_nx_ex<V>( &mut self, key: String, value: V, ttl_in_seconds: usize, ) -> Result<RedisValue, RedisError>
where V: ToRedisArgs + Send + Sync,

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<V>( &mut self, key: String, value: V, ) -> Result<usize, RedisError>
where V: ToRedisArgs + Send + Sync,

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,