Keyspace notifications 让客户端通过 Pub/Sub 订阅有关键的更改事件——例如键被设置、删除或过期。它们支持对 Redis 中数据变化的反应,其中过期事件是特别常见且有用的触发器。
启用和订阅
# keyspace notifications are OFF by default — enable the event classes you want
CONFIG SET notify-keyspace-events KEA # K=keyspace, E=keyevent, A=all event types
PSUBSCRIBE
PSUBSCRIBE
