Redis Tutorial
Use Redis well: data types, caching with TTLs, atomic operations, streams, persistence and safe operations
Intermediate4 lessonsabout 22 min of reading
This course is for backend developers who have used a relational database and now want to understand what Redis is good for, and just as importantly what it is not good for. You should be comfortable with a terminal and with one programming language; the examples use redis-cli and Python with the redis-py client, but the commands are the same everywhere.
The four lessons build from the data model to operations. First the data types and the core commands you will use daily. Then caching: time-to-live, cache-aside and invalidation, without re-teaching theory that is covered in Caching: Strategies, Eviction and Pitfalls. Third, atomic operations, pub/sub, streams and simple locks, including where each one breaks down. Finally persistence, eviction policies and the settings that keep an instance safe in production.
A note on how this course was verified: Redis was not installed in the environment where it was written, so the redis-cli transcripts show only replies that are fixed by the documented behaviour of the commands (such as OK, integer counts and the structure of stream replies). Anything whose exact value depends on timing, memory or your version is described in words instead of invented.
Redis lessons
- 1Redis Data Types and Core Commands with redis-cli ExamplesLearn Redis data types and core commands: strings, hashes, lists, sets and sorted sets, key naming, TTLs and SCAN, with a pub-quiz leaderboard example.5 min read
- 2Redis Caching: Cache-Aside, TTLs and Invalidation in PracticeImplement Redis caching with cache-aside, TTL jitter, delete-on-write invalidation, stampede protection and negative caching, with runnable Python code.5 min read
- 3Redis Atomic Operations, Pub/Sub, Streams and Distributed LocksUse Redis atomic commands, Lua scripts, pub/sub, streams with consumer groups and simple locks safely, and learn the limits of each before you rely on them.6 min read
- 4Redis Persistence, Eviction Policies and Safe OperationsUnderstand Redis persistence (RDB snapshots and AOF), maxmemory eviction policies and the security and operations settings that keep a production instance safe.6 min read
Preparing for an interview? Practise System Design interview questions
Learning Redis to land a job? Browse open roles or check which skills are trending.