Connection

Enum Connection 

Source
pub enum Connection {
    Single(SingleConn),
    Clustered(ClusterConn),
    Metered(MeteredConn),
}

Variants§

§

Single(SingleConn)

§

Clustered(ClusterConn)

§

Metered(MeteredConn)

Implementations§

Source§

impl Connection

Source

pub async fn query<T>(&mut self, cmd: Cmd) -> Result<T, Error>
where T: FromRedisValue + Send + 'static,

Source

pub fn partition_keys_by_node<'a, I, K>( &self, keys: I, ) -> Result<HashMap<Address, Vec<&'a K>>, Error>
where &'a K: ToRedisArgs, I: Iterator<Item = &'a K>,

Source

pub async fn exists<K>(&mut self, key: K) -> Result<u64, Error>
where K: ToRedisArgs,

Tells if the given key(s) exist.

Returns the number of matches for the given key(s).

Source

pub async fn get<K, T>(&mut self, key: K) -> Result<T, Error>
where K: ToRedisArgs, T: FromRedisValue + Send + 'static,

Source

pub async fn hget<H, K, T>(&mut self, hash: H, key: K) -> Result<T, Error>
where H: ToRedisArgs, K: ToRedisArgs, T: FromRedisValue + Send + 'static,

Source

pub async fn hget_all<H, T>(&mut self, hash: H) -> Result<T, Error>
where H: ToRedisArgs, T: FromRedisValue + Send + 'static,

Source

pub async fn ttl<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<i64>, Error>

Source

pub async fn pttl<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<i64>, Error>

Source

pub async fn del<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<u64>, Error>

Source

pub async fn ping(&mut self) -> Result<(), Error>

Source

pub async fn multi(&mut self) -> Result<ConnectionMulti<'_>, Error>

Source

pub async fn set<K, D>(&mut self, key: K, data: D) -> Result<(), Error>
where K: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn set_expiry<K, D>( &mut self, key: K, ttl: Duration, data: D, ) -> Result<(), Error>
where K: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn z_add<K, D>( &mut self, key: K, score: i64, data: D, ) -> Result<u64, Error>
where K: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn zadd_binary<K, T>( &mut self, key: K, score: i64, member: T, ) -> Result<i64, Error>
where K: ToRedisArgs, T: AsRef<[u8]>,

Source

pub async fn z_range<K, T>( &mut self, key: K, min: i64, max: i64, is_reversed: bool, ) -> Result<T, Error>
where K: ToRedisArgs, T: FromRedisValue + Send + 'static,

Source

pub async fn z_rem<K, T>(&mut self, key: K, members: T) -> Result<u64, Error>
where K: ToRedisArgs, T: ToRedisArgs,

Source

pub async fn zrem_all<K>(&mut self, key: K) -> Result<i64, Error>
where K: ToRedisArgs,

Source

pub async fn z_card<K>(&mut self, key: K) -> Result<i64, Error>
where K: ToRedisArgs,

Source

pub async fn incr_by<T: ToRedisArgs>( &mut self, key: T, increment: i64, ) -> Result<i64, Error>

Source

pub async fn hset<H, D>(&mut self, hash: H, data: D) -> Result<i64, Error>
where H: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn hdel<H, D>(&mut self, hash: H, data: D) -> Result<i64, Error>
where H: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn expire<T: ToRedisArgs>( &mut self, key: T, ttl: Duration, ) -> Result<(), Error>

Source

pub async fn set_nx_ex<K, D>( &mut self, key: K, ttl: Duration, data: D, ) -> Result<bool, Error>
where K: ToRedisArgs, D: ToRedisArgs,

Source

pub async fn xread<'s, T, S>( &mut self, streams: &[ReadStream<'s, S>], options: &ReadStreamOptions, ) -> Result<StreamReadReply<S, T>, Error>
where T: FromRedisValue + Send + 'static, S: FromRedisValue + Eq + Hash + Send + 'static, &'s S: ToRedisArgs,

Source

pub async fn xlen<'s, S>(&mut self, stream_id: &'s S) -> Result<u64, Error>

Trait Implementations§

Source§

impl ConnectionManager for Connection

Source§

type Address = Client

Any information needed to connect to a database e.g. IP, port, username, password
Source§

type Connection = Connection

A connection to the database
Source§

type Error = Error

All operations may return this error type
Source§

fn connect<'life0, 'async_trait>( address: &'life0 Client, ) -> Pin<Box<dyn Future<Output = Result<Connection, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,

Connect to a given address
Source§

fn check_alive(connection: &Self::Connection) -> Option<bool>

Check if the connection is in a good state. If None, the status is unknown and the database should be pinged.
Source§

fn ping<'life0, 'async_trait>( connection: &'life0 mut Self::Connection, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ping the database
Source§

fn reset_connection( _connection: &mut Self::Connection, ) -> Option<BoxFuture<'_, Result<(), Self::Error>>>

Reset the connection to a fresh state for reuse If this doesn’t perform a network operation, returns None

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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