修改redis服务器的配置文件,设置notify-keyspace-events值为Ex。 当有key过期时,订阅__keyevent@0__:expired的客户端就会收到消息(过期的key)。 相关文章: