Skip to main content

ShardCacheDirectClient

Struct ShardCacheDirectClient 

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

Blocking SCNP client that automatically routes each key to its shard port.

Implementations§

Source§

impl ShardCacheDirectClient

Source

pub fn connect(addr: impl ToSocketAddrs, shard_count: usize) -> Result<Self>

Connects to every shard-owned port starting at addr.

addr must be the first direct shard port, not the fanout port.

Source

pub fn connect_with_route_mode( addr: impl ToSocketAddrs, shard_count: usize, route_mode: ShardCacheRouteMode, ) -> Result<Self>

Connects to every shard-owned port using an explicit route mode.

Source

pub fn get_into(&mut self, key: &[u8], out: &mut Vec<u8>) -> Result<bool>

Reads key from its owning shard into out, returning true on hit.

Source

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

Sets key on its owning shard.

Source

pub fn set_ex(&mut self, key: &[u8], value: &[u8], ttl_ms: u64) -> Result<()>

Sets key on its owning shard with a millisecond TTL.

Source

pub fn get_ex_into( &mut self, key: &[u8], ttl_ms: u64, out: &mut Vec<u8>, ) -> Result<bool>

Reads key from its owning shard into out and sets a millisecond TTL.

Source

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

Deletes key from its owning shard.

Source

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

Returns whether key exists on its owning shard.

Source

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

Returns Redis-compatible TTL seconds for key on its owning shard.

Source

pub fn expire(&mut self, key: &[u8], ttl_ms: u64) -> Result<bool>

Sets a millisecond TTL on key on its owning shard.

Source

pub fn scan_shard_resp_into( &mut self, shard_id: usize, cursor: u64, count: usize, out: &mut Vec<u8>, ) -> Result<bool>

Runs a shard-local SCNP scan on one direct shard connection. Callers can invoke this for different shards from different threads for parallel scans.

Trait Implementations§

Source§

impl Debug for ShardCacheDirectClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.