Skip to main content

ShardCacheClient

Struct ShardCacheClient 

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

Blocking SCNP client for the ordinary server listener.

Implementations§

Source§

impl ShardCacheClient

Source

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

Connects to a shardcache server listener that accepts generic SCNP.

Source

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

Reads key into out, returning true on hit.

Source

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

Sets key to value.

Source

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

Sets key to value 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 into out and sets a millisecond TTL, returning true on hit.

Source

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

Deletes key, returning true when an entry was removed.

Source

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

Returns whether key exists.

Source

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

Returns Redis-compatible TTL seconds for key.

Source

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

Sets a millisecond TTL on key, returning true when the TTL changed.

Source

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

Executes a Redis-compatible command through the generic SCNP wrapper.

The server returns RESP bytes as an SCNP value. out receives those raw bytes so callers can decode exactly the shape they requested.

Source

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

Runs the global SCNP scan wrapper and returns the RESP scan reply bytes.

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. Call this concurrently per shard to avoid a server-side fanout scan.

Source

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

Writes a GET request without flushing or reading its response.

Source

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

Writes a SET request without flushing or reading its response.

Source

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

Writes a SETEX request without flushing or reading its response.

Source

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

Writes a GETEX request without flushing or reading its response.

Source

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

Writes a DEL request without flushing or reading its response.

Source

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

Writes an EXISTS request without flushing or reading its response.

Source

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

Writes a TTL request without flushing or reading its response.

Source

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

Writes an EXPIRE request without flushing or reading its response.

Source

pub fn flush_pipeline(&mut self) -> Result<()>

Flushes all queued pipelined requests.

Source

pub fn finish_pipeline_get_into(&mut self, out: &mut Vec<u8>) -> Result<bool>

Reads the next pipelined GET response.

Source

pub fn finish_pipeline_set(&mut self) -> Result<()>

Reads the next pipelined SET response.

Source

pub fn finish_pipeline_set_ex(&mut self) -> Result<()>

Reads the next pipelined SETEX response.

Source

pub fn finish_pipeline_get_ex_into(&mut self, out: &mut Vec<u8>) -> Result<bool>

Reads the next pipelined GETEX response.

Source

pub fn finish_pipeline_del(&mut self) -> Result<bool>

Reads the next pipelined DEL response.

Source

pub fn finish_pipeline_exists(&mut self) -> Result<bool>

Reads the next pipelined EXISTS response.

Source

pub fn finish_pipeline_ttl(&mut self) -> Result<i64>

Reads the next pipelined TTL response.

Source

pub fn finish_pipeline_expire(&mut self) -> Result<bool>

Reads the next pipelined EXPIRE response.

Trait Implementations§

Source§

impl Debug for ShardCacheClient

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.