Redis
An in-memory key-value store used for caching, sessions, and queues.
CurrentintermediateGuide only -- no course yet
Overview
Redis is an in-memory data store (with optional persistence to disk) used primarily for caching, session storage, rate limiting, and simple message queues -- valued for its speed since data lives in RAM rather than on disk.
- What it is
- An in-memory key-value data store, supporting strings, lists, sets, hashes, and more.
- Why it's used
- For very fast reads/writes (caching a database query result, storing a user session, rate-limiting counters).
- Where it fits
- Usually alongside a primary database, not replacing it -- Redis typically holds transient or derived data, not the system of record.
Core concepts
- Key-value storage
- Data structures (lists, sets, hashes, sorted sets)
- Expiring keys (TTL)
- Pub/sub messaging
Example
EX 3600 sets a 60-minute expiration on the key -- a common pattern for session storage or rate-limiting counters where data should automatically disappear.
SET session:abc123 "user-42" EX 3600
GET session:abc123Common use cases
- Caching expensive database queries
- Session storage
- Rate limiting
- Simple job queues
Project ideas
- Design a caching layer (on paper) for an expensive database query, including how to invalidate the cache when the underlying data changes