Redis › Keyspace Notifications
What are the reliability limitations of keyspace notifications that developers should understand before relying on them for critical application logic?
IntermediateAnswer
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__:expiredReal-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.