Skip to main content

Crate ringline_memcache

Crate ringline_memcache 

Source
Expand description

ringline-native Memcache client for use inside the ringline async runtime.

This client wraps a ringline::ConnCtx and provides typed Memcache command methods that use with_bytes() + ResponseBytes::parse() for zero-copy incremental parsing. It is designed for single-threaded, single-connection use within ringline’s AsyncEventHandler::on_start() or connection tasks.

All key and value parameters accept impl AsRef<[u8]>, so you can pass &str, String, &[u8], Vec<u8>, Bytes, etc.

§Example

use ringline::ConnCtx;
use ringline_memcache::Client;

async fn example(conn: ConnCtx) -> Result<(), ringline_memcache::Error> {
    let mut client = Client::new(conn);
    client.set("hello", "world").await?;
    let val = client.get("hello").await?;
    assert_eq!(val.unwrap().data.as_ref(), b"world");
    Ok(())
}

§Copy Semantics

PathCopiesMechanism
Recv (values)0with_bytes() + ResponseBytes::parse(). Keys and values are Bytes::slice() references into the accumulator – zero allocation, O(1) refcount.
Send (commands)1encode_request() serializes into Vec<u8>, then conn.send() copies into the send pool.
Send (SET value, guard)0 (value)Client::set_with_guard: prefix+suffix copied to pool, value stays in-place via SendGuard.

TLS connections add encryption copies on the send path regardless of SendGuard usage.

Re-exports§

pub use pool::Pool;
pub use pool::PoolConfig;
pub use sharded::ShardedClient;
pub use sharded::ShardedConfig;

Modules§

pool
Connection pool for ringline-memcache.
sharded
Ketama-sharded client for ringline-memcache.

Structs§

Client
A ringline-native Memcache client wrapping a single connection.
ClientBuilder
Builder for creating a Client with per-request callbacks and metrics.
ClientMetrics
Built-in histogram-based metrics, available when the metrics feature is enabled. Not registered globally — the caller decides how to expose them.
CommandResult
Result metadata for a completed command, passed to the on_result callback.
GetValue
A value returned from a multi-key GET command, including the key.
Value
A value returned from a single-key GET command.

Enums§

CommandType
The type of Memcache command that completed.
CompletedOp
A completed fire/recv operation with its result.
Error
Errors returned by the ringline Memcache client.