Redis (Remote Dictionary Server) is an in-memory data structure store used primarily as a cache, message broker, and real-time data store. Unlike disk-based databases that persist data to storage and read it back on query, Redis stores all data in RAM, enabling sub-millisecond read and write latency at high throughput (typically 100,000–1,000,000 operations per second on a single node). Redis supports a rich set of native data structures — strings, hashes, lists, sets, sorted sets, streams, and HyperLogLog — each with purpose-built commands optimised for specific access patterns. This makes Redis far more powerful than a simple key-value store.
For data engineers, Redis appears in three distinct roles. As a cache, Redis stores the computed results of expensive database queries with a configured TTL (time to live) — subsequent requests return the cached result in microseconds rather than re-running the query. As a message broker, Redis Streams and the pub/sub system enable decoupled, asynchronous communication between pipeline components — a producer writes events, consumers read and process them independently. As a real-time leaderboard or counter store, Redis sorted sets and atomic increment commands maintain live rankings and counters that update instantly without database round-trips.
Redis persistence options range from fully in-memory (data lost on restart) to semi-durable (RDB snapshots at configured intervals) to near-durable (AOF append-only file logging every write command). For cache use cases, no persistence is needed — cache misses simply refill from the source. For message broker use cases where message loss is unacceptable, AOF with fsync on every write (appendfsync always) provides near-PostgreSQL durability at the cost of write throughput. Understanding the persistence trade-offs determines whether Redis is appropriate for each specific use case in a data pipeline.