pub struct AsyncClusterClient { /* private fields */ }Expand description
One open connection per distinct shard node + a slot→shard table.
Implementations§
Source§impl AsyncClusterClient
impl AsyncClusterClient
Sourcepub async fn connect(host: &str, port: u16) -> Result<Self>
pub async fn connect(host: &str, port: u16) -> Result<Self>
Connect via a seed node, discover topology, open one connection per shard.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Number of distinct shard nodes.
Sourcepub async fn request_keyed(
&mut self,
key: &[u8],
args: &[Vec<u8>],
) -> Result<Reply>
pub async fn request_keyed( &mut self, key: &[u8], args: &[Vec<u8>], ) -> Result<Reply>
Route a single-key command to its owner shard.
Sourcepub async fn request_unkeyed(&mut self, args: &[Vec<u8>]) -> Result<Reply>
pub async fn request_unkeyed(&mut self, args: &[Vec<u8>]) -> Result<Reply>
Keyless command — answered identically by any shard.
Sourcepub async fn publish(&mut self, channel: &[u8], message: &[u8]) -> Result<usize>
pub async fn publish(&mut self, channel: &[u8], message: &[u8]) -> Result<usize>
PUBLISH channel message. Returns subscriber count.
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.
Sourcepub async fn del(&mut self, keys: &[&[u8]]) -> Result<usize>
pub async fn del(&mut self, keys: &[&[u8]]) -> Result<usize>
DEL key [key ...] — routed per key, summed.
Sourcepub async fn exists(&mut self, keys: &[&[u8]]) -> Result<usize>
pub async fn exists(&mut self, keys: &[&[u8]]) -> Result<usize>
EXISTS key [key ...] — routed per key, summed.
Auto Trait Implementations§
impl Freeze for AsyncClusterClient
impl RefUnwindSafe for AsyncClusterClient
impl Send for AsyncClusterClient
impl Sync for AsyncClusterClient
impl Unpin for AsyncClusterClient
impl UnsafeUnpin for AsyncClusterClient
impl UnwindSafe for AsyncClusterClient
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