Skip to main content

Module redis

Module redis 

Source
Expand description

A Redis client written from scratch on Tokio TCP.

Three layers, each independently testable:

  • resp — the wire format. Pure functions over byte slices, so the protocol tests need no server at all.
  • connection — one socket, the handshake, and command/reply framing.
  • pool — a bounded set of connections, discarding any that broke.

On top sits RedisStore, the Cache implementation. It uses only GET, SET, DEL, EXISTS, INCRBY, DECRBY, FLUSHDB, EXPIRE, PEXPIRE, PTTL, PING and AUTH/SELECT — a small enough surface that it also works against the Redis-compatible servers (Valkey, KeyDB, Dragonfly) people actually deploy.

Re-exports§

pub use config::RedisConfig;
pub use connection::Connection;
pub use pool::Pool;
pub use pool::PooledConnection;
pub use resp::Value;

Modules§

config
Redis connection settings, from a URL or from the application config.
connection
One Redis connection: a TCP socket, a read buffer, and the handshake.
pool
A small connection pool.
resp
RESP2: the Redis serialization protocol, encoder and decoder.

Structs§

RedisStore
A cache backed by Redis.