Redis › Streams

What is a Redis Stream, and how does it differ from a regular Redis list when used as a messaging system?

Beginner

Answer

A Redis Stream is an append only log data structure specifically designed for messaging, where every added entry receives a unique id and remains stored in the stream even after being read, unlike a list where items are typically removed once processed, letting multiple different consumers read and replay the same messages independently.
XADD mystream '*' sensor 'temp1' value '22.5'
XRANGE mystream - +
Real-world example An event logging system uses a Redis Stream to record every user action, allowing multiple different downstream services to independently process the same events at their own pace without consuming or removing them for other consumers.

Common follow-ups: What does the asterisk represent when adding an entry to a stream?;Can entries be manually removed from a stream, or do they stay forever?