redis-rs
An idiomatic, high-level Redis and Valkey client for Rust with sync, async, and cluster support.
Repository Health
Technical Analysis
redis-rs is a Rust library implementing a high-level client for Redis, Valkey, and any other RESP (Redis Serialization Protocol) compliant server. It exposes the full range of Redis functionality through a flexible, low-level command API paired with a customizable type-conversion trait, so commands can return results directly as the Rust type the caller expects rather than requiring manual parsing of raw replies.
The crate supports both synchronous and asynchronous (tokio/async-std) connections, connection pooling via r2d2/bb8, pub/sub, Redis Cluster and Sentinel topologies, TLS, and pipelining. It’s one of the most widely depended-upon Redis clients in the Rust ecosystem, published as the redis crate and consumed transitively by countless web services, caching layers, and job queues built in Rust.
What You Get
- Synchronous and async (tokio, async-std) client connections to Redis/Valkey
- A generic command API with a
FromRedisValue/ToRedisArgstype-conversion system - Redis Cluster and Sentinel client support for high-availability deployments
- Pub/sub support including an async subscription tracker
- Pipelining and transaction (MULTI/EXEC) support
- Optional integration with
r2d2andbb8connection pools, plus TLS and cloud-auth (Entra ID) support
Common Use Cases
- Caching layers for Rust web services (session storage, response caching, rate limiting)
- Pub/sub messaging and event distribution between Rust services
- Connecting to Redis Cluster or Sentinel deployments for high-availability production setups
- Job/task queues backed by Redis lists or streams
- Async data access in tokio-based Rust backends via the async connection API
Under The Hood
Architecture - The workspace root Cargo.toml defines a multi-crate layout with the primary redis crate under redis/, plus redis-test for test utilities and a valkey/ directory tracking Valkey-specific compatibility. Inside redis/src/, the client is split by concern: connection.rs and client.rs handle connection establishment, cmd.rs/pipeline.rs build and dispatch commands, parser.rs decodes RESP replies, types.rs defines the FromRedisValue/ToRedisArgs conversion traits, and dedicated modules (cluster_handling/, sentinel.rs, subscription_tracker.rs, aio/) layer cluster, sentinel, and async pub/sub support on top of the core connection primitives.
Tech Stack - Pure Rust, edition 2024, minimum Rust version 1.88 per redis/Cargo.toml. Core dependencies are intentionally minimal (ryu, itoa, percent-encoding for formatting/parsing), with heavier functionality — tokio/async-std runtimes, TLS backends, r2d2/bb8 pooling, and cluster support — gated behind Cargo feature flags so consumers only pay for what they use. An afl/ directory holds fuzz-testing harnesses for the RESP parser.
Code Quality - The redis/tests/ directory contains 27 integration test files covering cluster handling, TLS, pub/sub, scripting, and pooling integrations (r2d2.rs, bb8.rs), and a CODING_CONVENTIONS.md documents the project’s style expectations for contributors. Fuzz testing via afl on the parser indicates attention to protocol-parsing correctness, which matters given RESP is a binary-safe, hand-rolled protocol. CI runs via GitHub Actions with a badge showing build status against multiple Redis/Valkey versions.
API Design - The API centers on a Client/Connection pair and a cmd() builder for issuing arbitrary Redis commands, with results generically deserialized via the FromRedisValue trait — so .query::<String>() or .query::<HashMap<String, i32>>() both work against the same command without separate typed methods per command. This low-level-but-typed approach trades some discoverability (commands aren’t individually named methods for every Redis command) for flexibility across the full RESP command surface, including newer Redis/Valkey commands the crate hasn’t added a dedicated wrapper for yet.
Used by 12 apps in this directory
Arroyo
Data Engineering · Analytics
A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.
cocoindex
Data Engineering · AI Development
An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.
Cryptgeon
File Storage · Security
Self-destructing encrypted notes and files that vanish after viewing — the server never sees your keys.
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
iii
Developer Tools · Devops
Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.
Laminar
AI Development · Monitoring
Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.
OpenViking
Databases · AI Development
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.