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
| Path | Copies | Mechanism |
|---|---|---|
| Recv (values) | 0 | with_bytes() + ResponseBytes::parse(). Keys and values are Bytes::slice() references into the accumulator – zero allocation, O(1) refcount. |
| Send (commands) | 1 | encode_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§
Structs§
- Client
- A ringline-native Memcache client wrapping a single connection.
- Client
Builder - Builder for creating a
Clientwith per-request callbacks and metrics. - Client
Metrics - Built-in histogram-based metrics, available when the
metricsfeature is enabled. Not registered globally — the caller decides how to expose them. - Command
Result - Result metadata for a completed command, passed to the
on_resultcallback. - GetValue
- A value returned from a multi-key GET command, including the key.
- Value
- A value returned from a single-key GET command.
Enums§
- Command
Type - The type of Memcache command that completed.
- Completed
Op - A completed fire/recv operation with its result.
- Error
- Errors returned by the ringline Memcache client.