pub struct ShardCacheClient { /* private fields */ }Expand description
Blocking SCNP client for the ordinary server listener.
Implementations§
Source§impl ShardCacheClient
impl ShardCacheClient
Sourcepub fn connect(addr: impl ToSocketAddrs) -> Result<Self>
pub fn connect(addr: impl ToSocketAddrs) -> Result<Self>
Connects to a shardcache server listener that accepts generic SCNP.
Sourcepub fn get_into(&mut self, key: &[u8], out: &mut Vec<u8>) -> Result<bool>
pub fn get_into(&mut self, key: &[u8], out: &mut Vec<u8>) -> Result<bool>
Reads key into out, returning true on hit.
Sourcepub fn set_ex(&mut self, key: &[u8], value: &[u8], ttl_ms: u64) -> Result<()>
pub fn set_ex(&mut self, key: &[u8], value: &[u8], ttl_ms: u64) -> Result<()>
Sets key to value with a millisecond TTL.
Sourcepub fn get_ex_into(
&mut self,
key: &[u8],
ttl_ms: u64,
out: &mut Vec<u8>,
) -> Result<bool>
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.
Sourcepub fn del(&mut self, key: &[u8]) -> Result<bool>
pub fn del(&mut self, key: &[u8]) -> Result<bool>
Deletes key, returning true when an entry was removed.
Sourcepub fn expire(&mut self, key: &[u8], ttl_ms: u64) -> Result<bool>
pub fn expire(&mut self, key: &[u8], ttl_ms: u64) -> Result<bool>
Sets a millisecond TTL on key, returning true when the TTL changed.
Sourcepub fn resp_command_into(
&mut self,
parts: &[&[u8]],
out: &mut Vec<u8>,
) -> Result<bool>
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.
Sourcepub fn scan_resp_into(
&mut self,
cursor: u64,
count: usize,
out: &mut Vec<u8>,
) -> Result<bool>
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.
Sourcepub fn scan_shard_resp_into(
&mut self,
shard_id: usize,
cursor: u64,
count: usize,
out: &mut Vec<u8>,
) -> Result<bool>
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.
Sourcepub fn begin_pipeline_get(&mut self, key: &[u8]) -> Result<()>
pub fn begin_pipeline_get(&mut self, key: &[u8]) -> Result<()>
Writes a GET request without flushing or reading its response.
Sourcepub fn begin_pipeline_set(&mut self, key: &[u8], value: &[u8]) -> Result<()>
pub fn begin_pipeline_set(&mut self, key: &[u8], value: &[u8]) -> Result<()>
Writes a SET request without flushing or reading its response.
Sourcepub fn begin_pipeline_set_ex(
&mut self,
key: &[u8],
value: &[u8],
ttl_ms: u64,
) -> Result<()>
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.
Sourcepub fn begin_pipeline_get_ex(&mut self, key: &[u8], ttl_ms: u64) -> Result<()>
pub fn begin_pipeline_get_ex(&mut self, key: &[u8], ttl_ms: u64) -> Result<()>
Writes a GETEX request without flushing or reading its response.
Sourcepub fn begin_pipeline_del(&mut self, key: &[u8]) -> Result<()>
pub fn begin_pipeline_del(&mut self, key: &[u8]) -> Result<()>
Writes a DEL request without flushing or reading its response.
Sourcepub fn begin_pipeline_exists(&mut self, key: &[u8]) -> Result<()>
pub fn begin_pipeline_exists(&mut self, key: &[u8]) -> Result<()>
Writes an EXISTS request without flushing or reading its response.
Sourcepub fn begin_pipeline_ttl(&mut self, key: &[u8]) -> Result<()>
pub fn begin_pipeline_ttl(&mut self, key: &[u8]) -> Result<()>
Writes a TTL request without flushing or reading its response.
Sourcepub fn begin_pipeline_expire(&mut self, key: &[u8], ttl_ms: u64) -> Result<()>
pub fn begin_pipeline_expire(&mut self, key: &[u8], ttl_ms: u64) -> Result<()>
Writes an EXPIRE request without flushing or reading its response.
Sourcepub fn flush_pipeline(&mut self) -> Result<()>
pub fn flush_pipeline(&mut self) -> Result<()>
Flushes all queued pipelined requests.
Sourcepub fn finish_pipeline_get_into(&mut self, out: &mut Vec<u8>) -> Result<bool>
pub fn finish_pipeline_get_into(&mut self, out: &mut Vec<u8>) -> Result<bool>
Reads the next pipelined GET response.
Sourcepub fn finish_pipeline_set(&mut self) -> Result<()>
pub fn finish_pipeline_set(&mut self) -> Result<()>
Reads the next pipelined SET response.
Sourcepub fn finish_pipeline_set_ex(&mut self) -> Result<()>
pub fn finish_pipeline_set_ex(&mut self) -> Result<()>
Reads the next pipelined SETEX response.
Sourcepub fn finish_pipeline_get_ex_into(&mut self, out: &mut Vec<u8>) -> Result<bool>
pub fn finish_pipeline_get_ex_into(&mut self, out: &mut Vec<u8>) -> Result<bool>
Reads the next pipelined GETEX response.
Sourcepub fn finish_pipeline_del(&mut self) -> Result<bool>
pub fn finish_pipeline_del(&mut self) -> Result<bool>
Reads the next pipelined DEL response.
Sourcepub fn finish_pipeline_exists(&mut self) -> Result<bool>
pub fn finish_pipeline_exists(&mut self) -> Result<bool>
Reads the next pipelined EXISTS response.
Sourcepub fn finish_pipeline_ttl(&mut self) -> Result<i64>
pub fn finish_pipeline_ttl(&mut self) -> Result<i64>
Reads the next pipelined TTL response.
Sourcepub fn finish_pipeline_expire(&mut self) -> Result<bool>
pub fn finish_pipeline_expire(&mut self) -> Result<bool>
Reads the next pipelined EXPIRE response.