Skip to main content

AsyncClusterClient

Struct AsyncClusterClient 

Source
pub struct AsyncClusterClient { /* private fields */ }
Expand description

One open connection per distinct shard node + a slot→shard table.

Implementations§

Source§

impl AsyncClusterClient

Source

pub async fn connect(host: &str, port: u16) -> Result<Self>

Connect via a seed node, discover topology, open one connection per shard.

Source

pub fn shard_count(&self) -> usize

Number of distinct shard nodes.

Source

pub async fn request_keyed( &mut self, key: &[u8], args: &[Vec<u8>], ) -> Result<Reply>

Route a single-key command to its owner shard.

Source

pub async fn request_unkeyed(&mut self, args: &[Vec<u8>]) -> Result<Reply>

Keyless command — answered identically by any shard.

Source

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

PING. Answered by any shard.

Source

pub async fn publish(&mut self, channel: &[u8], message: &[u8]) -> Result<usize>

PUBLISH channel message. Returns subscriber count.

Source

pub async fn set(&mut self, key: &[u8], value: &[u8]) -> Result<()>

SET key value.

Source

pub async fn set_with_ttl( &mut self, key: &[u8], value: &[u8], ttl: Duration, ) -> Result<()>

SET key value PX ttl_ms.

Source

pub async fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>

GET key.

Source

pub async fn incr(&mut self, key: &[u8]) -> Result<i64>

INCR key.

Source

pub async fn incr_by(&mut self, key: &[u8], delta: i64) -> Result<i64>

INCRBY key delta.

Source

pub async fn expire(&mut self, key: &[u8], ttl: Duration) -> Result<bool>

PEXPIRE key ttl_ms.

Source

pub async fn persist(&mut self, key: &[u8]) -> Result<bool>

PERSIST key.

Source

pub async fn ttl_ms(&mut self, key: &[u8]) -> Result<i64>

PTTL key.

Source

pub async fn del(&mut self, keys: &[&[u8]]) -> Result<usize>

DEL key [key ...] — routed per key, summed.

Source

pub async fn exists(&mut self, keys: &[&[u8]]) -> Result<usize>

EXISTS key [key ...] — routed per key, summed.

Source

pub async fn dbsize(&mut self) -> Result<usize>

DBSIZE — cluster-wide total (server fans out internally).

Source

pub async fn flushall(&mut self) -> Result<()>

FLUSHALL — clears every shard.

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