InterviewHubPRO
Section Overview
Q49

Question 49 of 60

Part 4: In-Memory Caching & Fast Data Stores (Redis) (41 - 50)

82%
Databases & System Design•Part 4: In-Memory Caching & Fast Data Stores (Redis) (41 - 50)

Redis Pub/Sub vs Redis Streams:

In Simple Words:

  • Pub/Sub: Fire-and-forget; messages are not saved.
  • Streams: Persistent message log with Consumer Groups and acknowledgments (XACK).
bash
# Redis Streams example:
XADD mystream * sensor_id 101 temperature 24.5
XREADGROUP GROUP mygroup consumer1 COUNT 10 STREAMS mystream >
XACK mystream mygroup "1730000000000-0"