pub enum Connection {
Single(SingleConn),
Clustered(ClusterConn),
Metered(MeteredConn),
}Variants§
Implementations§
Source§impl Connection
impl Connection
pub async fn query<T>(&mut self, cmd: Cmd) -> Result<T, Error>where
T: FromRedisValue + Send + 'static,
pub fn partition_keys_by_node<'a, I, K>( &self, keys: I, ) -> Result<HashMap<Address, Vec<&'a K>>, Error>
Sourcepub async fn exists<K>(&mut self, key: K) -> Result<u64, Error>where
K: ToRedisArgs,
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).
pub async fn get<K, T>(&mut self, key: K) -> Result<T, Error>
pub async fn hget<H, K, T>(&mut self, hash: H, key: K) -> Result<T, Error>
pub async fn hget_all<H, T>(&mut self, hash: H) -> Result<T, Error>
pub async fn ttl<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<i64>, Error>
pub async fn pttl<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<i64>, Error>
pub async fn del<T: ToRedisArgs>( &mut self, key: T, ) -> Result<Option<u64>, Error>
pub async fn ping(&mut self) -> Result<(), Error>
pub async fn multi(&mut self) -> Result<ConnectionMulti<'_>, Error>
pub async fn set<K, D>(&mut self, key: K, data: D) -> Result<(), Error>where
K: ToRedisArgs,
D: ToRedisArgs,
pub async fn set_expiry<K, D>(
&mut self,
key: K,
ttl: Duration,
data: D,
) -> Result<(), Error>where
K: ToRedisArgs,
D: ToRedisArgs,
pub async fn z_add<K, D>(
&mut self,
key: K,
score: i64,
data: D,
) -> Result<u64, Error>where
K: ToRedisArgs,
D: ToRedisArgs,
pub async fn zadd_binary<K, T>( &mut self, key: K, score: i64, member: T, ) -> Result<i64, Error>
pub async fn z_range<K, T>( &mut self, key: K, min: i64, max: i64, is_reversed: bool, ) -> Result<T, Error>
pub async fn z_rem<K, T>(&mut self, key: K, members: T) -> Result<u64, Error>where
K: ToRedisArgs,
T: ToRedisArgs,
pub async fn zrem_all<K>(&mut self, key: K) -> Result<i64, Error>where
K: ToRedisArgs,
pub async fn z_card<K>(&mut self, key: K) -> Result<i64, Error>where
K: ToRedisArgs,
pub async fn incr_by<T: ToRedisArgs>( &mut self, key: T, increment: i64, ) -> Result<i64, Error>
pub async fn hset<H, D>(&mut self, hash: H, data: D) -> Result<i64, Error>where
H: ToRedisArgs,
D: ToRedisArgs,
pub async fn hdel<H, D>(&mut self, hash: H, data: D) -> Result<i64, Error>where
H: ToRedisArgs,
D: ToRedisArgs,
pub async fn expire<T: ToRedisArgs>( &mut self, key: T, ttl: Duration, ) -> Result<(), Error>
pub async fn set_nx_ex<K, D>(
&mut self,
key: K,
ttl: Duration,
data: D,
) -> Result<bool, Error>where
K: ToRedisArgs,
D: ToRedisArgs,
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,
pub async fn xlen<'s, S>(&mut self, stream_id: &'s S) -> Result<u64, Error>where
&'s S: ToRedisArgs,
Trait Implementations§
Source§impl ConnectionManager for Connection
impl ConnectionManager for Connection
Source§type Address = Client
type Address = Client
Any information needed to connect to a database
e.g. IP, port, username, password
Source§type Connection = Connection
type Connection = Connection
A connection to the database
Source§fn connect<'life0, 'async_trait>(
address: &'life0 Client,
) -> Pin<Box<dyn Future<Output = Result<Connection, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
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>
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,
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>>>
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§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
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