A practical guide to Redis 7.x for developers and operators
Inspired by Tiago Macedo & Fred Oliveira's Redis Cookbook (2013), rewritten for Redis as it exists today.
The original Redis Cookbook was published when Redis 2.x was current. Since then, Redis has gained Streams, ACLs, TLS, active-active replication, Redis Cluster maturity, Lua functions, Redis Stack (JSON, Search, TimeSeries, Bloom filters), and fundamental changes to persistence and threading.
This book preserves the recipe-driven, problem-solving spirit of the original while covering modern tooling, security defaults, and deployment patterns you'd actually use in 2026.
Who this is for: Backend developers, SREs, and architects who know what a key-value store is but want concrete patterns—not a marketing brochure.
What you'll need: Redis 7.x or 8.x (most examples work on 6.2+), redis-cli, and optionally Python 3.10+, Node.js 20+, or Go 1.22+.
| # | Chapter | File |
|---|---|---|
| — | Preface | Why this book exists, conventions, how to read it |
| # | Chapter | File |
|---|---|---|
| 1 | An Introduction to Redis | When to use Redis, installation, data model, RESP3 |
| 2 | Clients | CLI, Python, Go, Node.js, connection pooling |
| # | Chapter | File |
|---|---|---|
| 3 | Strings and Keys | Counters, bitmaps, key patterns, expiration |
| 4 | Lists | Queues, capped lists, blocking operations |
| 5 | Sets | Tags, unique visitors, set algebra |
| 6 | Hashes | Objects, field-level updates, HSETEX |
| 7 | Sorted Sets | Leaderboards, time-series scores, range queries |
| 8 | Bitmaps, HyperLogLog & Bloom Filters | Cardinality, deduplication, probabilistic structures |
| 9 | Streams & Geospatial | Event logs, consumer groups, GEO commands |
| # | Chapter | File |
|---|---|---|
| 10 | Caching Patterns | Cache-aside, write-through, stampede prevention |
| 11 | Pub/Sub & Messaging | Chat, notifications, Streams vs Pub/Sub |
| 12 | Search & Analytics | Inverted indexes, time buckets, RediSearch |
| 13 | Job Queues & Task Workers | Reliable queues, delayed jobs, idempotency |
| 14 | Real-World Patterns | Rate limiting, sessions, distributed locks, OAuth tokens |
| # | Chapter | File |
|---|---|---|
| 15 | Persistence | RDB, AOF, hybrid persistence, backups |
| 16 | Replication | Primary/replica, read scaling, replication offsets |
| 17 | Sentinel & High Availability | Automatic failover, monitoring |
| 18 | Cluster & Sharding | Hash slots, resharding, client routing |
| 19 | Security, ACL & TLS | Users, permissions, encryption in transit |
| 20 | Performance & Tuning | Memory, latency, pipelining, slowlog |
| # | Chapter | File |
|---|---|---|
| 21 | Lua Scripting & Functions | Atomic server-side logic, Redis Functions |
| 22 | Transactions & Pipelining | MULTI/EXEC, WATCH, optimistic locking |
| 23 | Modules & Redis Stack | RedisJSON, RediSearch, TimeSeries, custom modules |
| 24 | Troubleshooting & Observability | INFO, latency doctor, common failure modes |
| # | Reference | File |
|---|---|---|
| A | Command Quick Reference | Most-used commands by category |
| B | Configuration Reference | Key redis.conf directives |
- New to Redis? Read Part I and II in order, then jump to recipes in Part III as needed.
- Operating Redis in production? Part IV is your home base; skim Part II for data-structure trade-offs.
- Migrating from the 2013 cookbook? Start with Preface — there's a mapping from old recipes to new chapters.
Each recipe follows a consistent format:
- Problem — What you're trying to solve
- Solution — Step-by-step with
redis-cliand client code - Discussion — Trade-offs, pitfalls, alternatives
- See Also — Related chapters and Redis docs
This book is provided as Markdown in this repository for personal and team use. Redis is © Redis Ltd.; command names and behavior refer to open-source Redis and Redis Stack documentation.