Stream Data Structures & Commands
Learn to add entries (`XADD`), read from streams (`XREAD`), and manage stream length.
Welcome to Stream Data
In the previous lesson, we learned what Redis Streams are. Now, let's dive into their core structure and how we interact with them.
Redis Streams are powerful, append-only data structures that act like a log, storing a sequence of entries. Each entry has a unique ID and a set of field-value pairs.
Stream Entry Anatomy
Each entry in a Redis Stream is like a small record. It consists of:
- Entry ID: A unique identifier, typically a timestamp and a sequence number (e.g.,
1678886400000-0). - Field-Value Pairs: One or more key-value pairs representing the actual data of the entry (e.g.,
sensor-id: 123,temperature: 25.5).
Think of it like a mini-hash map stored chronologically within the stream.
All lessons in this course
- What are Redis Streams?
- Stream Data Structures & Commands
- Stream Message Persistence
- Capping and Trimming Streams