pub struct AsyncConnection { /* private fields */ }Expand description
Async TCP-RESP connection. Mirrors [kevy_client::Connection] but
drops the mem:// / file:// embedded backends — those are
synchronous and have no async story.
Implementations§
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn hset(
&mut self,
key: &[u8],
pairs: &[(&[u8], &[u8])],
) -> Result<usize>
pub async fn hset( &mut self, key: &[u8], pairs: &[(&[u8], &[u8])], ) -> Result<usize>
HSET key field value [field value ...]. Returns count of
fields newly created (overwrites don’t count).
Sourcepub async fn hget(
&mut self,
key: &[u8],
field: &[u8],
) -> Result<Option<Vec<u8>>>
pub async fn hget( &mut self, key: &[u8], field: &[u8], ) -> Result<Option<Vec<u8>>>
HGET key field. None if key or field absent.
Sourcepub async fn hdel(&mut self, key: &[u8], fields: &[&[u8]]) -> Result<usize>
pub async fn hdel(&mut self, key: &[u8], fields: &[&[u8]]) -> Result<usize>
HDEL key field [field ...]. Returns count actually removed.
Sourcepub async fn hgetall(&mut self, key: &[u8]) -> Result<Vec<Vec<u8>>>
pub async fn hgetall(&mut self, key: &[u8]) -> Result<Vec<Vec<u8>>>
HGETALL key. Flat [f0, v0, f1, v1, ...]. Empty if absent.
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn lpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>
pub async fn lpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>
LPUSH key value [value ...]. Returns new list length.
Sourcepub async fn rpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>
pub async fn rpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>
RPUSH key value [value ...]. Returns new list length.
Sourcepub async fn lpop(&mut self, key: &[u8], count: usize) -> Result<Vec<Vec<u8>>>
pub async fn lpop(&mut self, key: &[u8], count: usize) -> Result<Vec<Vec<u8>>>
LPOP key count. Returns up to count head values; empty if
absent / drained.
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn sadd(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
pub async fn sadd(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
SADD key member [member ...]. Returns count of newly added.
Sourcepub async fn srem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
pub async fn srem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
SREM key member [member ...]. Returns count actually removed.
Sourcepub async fn smembers(&mut self, key: &[u8]) -> Result<Vec<Vec<u8>>>
pub async fn smembers(&mut self, key: &[u8]) -> Result<Vec<Vec<u8>>>
SMEMBERS key. Implementation-defined order; empty if absent.
Sourcepub async fn sismember(&mut self, key: &[u8], member: &[u8]) -> Result<bool>
pub async fn sismember(&mut self, key: &[u8], member: &[u8]) -> Result<bool>
SISMEMBER key member. false if absent.
Sourcepub async fn sinter(&mut self, keys: &[&[u8]]) -> Result<Vec<Vec<u8>>>
pub async fn sinter(&mut self, keys: &[&[u8]]) -> Result<Vec<Vec<u8>>>
SINTER key [key ...] — intersection of all sets.
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn set(&mut self, key: &[u8], value: &[u8]) -> Result<()>
pub async fn set(&mut self, key: &[u8], value: &[u8]) -> Result<()>
SET key value. Unconditional set; returns on +OK.
Sourcepub async fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
pub async fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
GET key. None if absent or expired.
Sourcepub async fn del(&mut self, keys: &[&[u8]]) -> Result<usize>
pub async fn del(&mut self, keys: &[&[u8]]) -> Result<usize>
DEL key [key ...]. Returns the count actually removed.
Sourcepub async fn exists(&mut self, keys: &[&[u8]]) -> Result<usize>
pub async fn exists(&mut self, keys: &[&[u8]]) -> Result<usize>
EXISTS key [key ...]. Count of keys present (a key passed N
times counts N if it exists).
Sourcepub async fn incr(&mut self, key: &[u8]) -> Result<i64>
pub async fn incr(&mut self, key: &[u8]) -> Result<i64>
INCR key. Returns post-increment value.
Sourcepub async fn incr_by(&mut self, key: &[u8], delta: i64) -> Result<i64>
pub async fn incr_by(&mut self, key: &[u8], delta: i64) -> Result<i64>
INCRBY key delta. Negative delta = DECRBY.
Sourcepub async fn expire(&mut self, key: &[u8], ttl: Duration) -> Result<bool>
pub async fn expire(&mut self, key: &[u8], ttl: Duration) -> Result<bool>
PEXPIRE key ttl_ms. Returns whether the key existed and got
a TTL set.
Sourcepub async fn persist(&mut self, key: &[u8]) -> Result<bool>
pub async fn persist(&mut self, key: &[u8]) -> Result<bool>
PERSIST key. Returns whether a TTL was removed.
Sourcepub async fn ttl_ms(&mut self, key: &[u8]) -> Result<i64>
pub async fn ttl_ms(&mut self, key: &[u8]) -> Result<i64>
PTTL key. Ms remaining, -2 if no key, -1 if no TTL.
Sourcepub async fn type_of(&mut self, key: &[u8]) -> Result<String>
pub async fn type_of(&mut self, key: &[u8]) -> Result<String>
TYPE key. Returns Redis-style type name ("string", "hash",
"list", "set", "zset", or "none").
Sourcepub async fn flushall(&mut self) -> Result<()>
pub async fn flushall(&mut self) -> Result<()>
FLUSHALL. WIPES the store. Named flushall not flush to
avoid colliding with Write::flush’s sync-to-disk meaning.
Sourcepub async fn set_with_ttl(
&mut self,
key: &[u8],
value: &[u8],
ttl: Duration,
) -> Result<()>
pub async fn set_with_ttl( &mut self, key: &[u8], value: &[u8], ttl: Duration, ) -> Result<()>
SET key value PX ttl_ms. Atomic cache-with-expiry.
Sourcepub async fn mget(&mut self, keys: &[&[u8]]) -> Result<Vec<Option<Vec<u8>>>>
pub async fn mget(&mut self, keys: &[&[u8]]) -> Result<Vec<Option<Vec<u8>>>>
MGET key [key ...] — one reply per key, in order.
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn zadd(
&mut self,
key: &[u8],
pairs: &[(f64, &[u8])],
) -> Result<usize>
pub async fn zadd( &mut self, key: &[u8], pairs: &[(f64, &[u8])], ) -> Result<usize>
ZADD key score member [score member ...]. Returns count of
newly added (overwrites don’t count).
Sourcepub async fn zrem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
pub async fn zrem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>
ZREM key member [member ...]. Returns count actually removed.
Source§impl AsyncConnection
impl AsyncConnection
Sourcepub async fn open(url: &str) -> Result<Self>
pub async fn open(url: &str) -> Result<Self>
Open a connection from a URL. Accepts kevy://, redis://,
tcp:// — see crate::url::parse_url for the full grammar.
If the URL carries a /N db index (only kevy:// and redis://),
an initial SELECT N round-trip runs before returning.
Sourcepub fn from_transport(transport: TcpStream) -> Self
pub fn from_transport(transport: TcpStream) -> Self
Direct constructor — useful when the caller wants to manage transport setup itself (cluster client, custom socket opts).
Sourcepub fn codec_mut(&mut self) -> &mut AsyncRespCodec<TcpStream>
pub fn codec_mut(&mut self) -> &mut AsyncRespCodec<TcpStream>
Borrow the underlying codec — exposed so pipeline + subscriber adapters built in later tasks (T4.11/T4.14) can share the connection state machine.