Redis › Keyspace Notifications
What are keyspace notifications in Redis, and what do they let your application do?
BeginnerAnswer
Keyspace notifications let Redis publish events whenever certain operations happen to keys, such as a key being set, deleted, or expiring, letting other parts of your application subscribe to and react to these changes in real time, rather than needing to constantly poll Redis to check if something has changed.
CONFIG SET notify-keyspace-events 'KEA'
SUBSCRIBE __keyevent@0__:expiredReal-world example A shopping cart application listens for expired key events, automatically cleaning up related order data whenever a customer's abandoned cart session expires, without needing a separate polling process.