Back to results for “Keyspace Notifications”
Redis › Keyspace Notifications

What are the reliability limitations of keyspace notifications that developers should understand before relying on them for critical application logic?

Intermediate

Answer

Keyspace notifications are delivered using Redis's Pub/Sub mechanism, which does not guarantee delivery, meaning if a subscribing client is disconnected or too slow to keep up when a notification is published, that specific notification is simply lost forever, making keyspace notifications unsuitable for critical logic that absolutely must never miss an event.
-- If no subscriber is actively listening when a key expires,
-- that specific expiration event is lost forever
SUBSCRIBE __keyevent@0__:expired
Real-world example A team initially relied on keyspace notifications to trigger a critical billing calculation, then redesigned their system after realizing a brief subscriber disconnection had caused several important events to be silently missed.

Common follow-ups: What alternative approaches provide guaranteed delivery instead of Pub/Sub based notifications?;How do you detect if your application has missed keyspace notifications?