我们知道redis是一种nosql数据库,作为缓存非常好用
支持`字符串,列表,集合以及hash`
今天讲讲redis键事件通知
我们在日常的应用中
经常要设置一个key,比如过期时间为10分钟
有没有办法当key失效的时候通知我们一下
我们就可以通过`键事件通知`来实现,如何实现呢
修改 redis.conf 中的 `notify-keyspace-events` 参数
我们可以在客户端订阅 subscribe __keyevent@0__:expired

在另一个客户端执行 `setex name 10 txl` ,10 秒过后,订阅端就会接收到消息

更多查看文章`https://www.cnblogs.com/tangxuliang/p/10659439.html`