redis 检查key expire事件
来源:互联网 发布:屏风专卖店淘宝网 编辑:程序博客网 时间:2024/06/09 10:50
refs:
https://stackoverflow.com/questions/35699811/subscribing-to-redis-expire-events-in-c-sharp-driver
https://redis.io/topics/notifications
1)config中使能 key space event watch;使能键观察,使能事件观察;
config set notify-keyspace-events KEx
2)sub相关键值
redis-cli --csv psubscribe '__keyspace@0__:dtu:*'
3)在service stack中,设置如下
注意expireKey此处是事件expire,ch中是keyPre和相应的键信息
//config set notify-keyspace-events KEx string EXPIRED_KEYS_CHANNEL = $"__keyspace@{redisConfigInfo.DefaultDb}__:{KeyPre}*"; using (var client = RedisManager.GetClient()) { using (var subscription = client.CreateSubscription()) { subscription.OnMessage += (ch, expiredKey) => { string ch_pre = EXPIRED_KEYS_CHANNEL.Replace("*",""); string bianhao = ch.Replace(ch_pre,""); OnExpired(bianhao); }; subscription.SubscribeToChannelsMatching(EXPIRED_KEYS_CHANNEL); } }
阅读全文
0 0
- redis 检查key expire事件
- 设置redis key的expire过期时间
- redis expire key 过期不删除
- Redis expire
- Redis Expire
- Redis 下key的过期时间详解 :expire
- redis 下key的过期时间详解:expire
- Redis 下key的过期时间详解 :expire
- redis 下key的过期时间详解 :expire
- Redis设置Key的过期时间 – EXPIRE命令
- Redis命令之EXPIRE
- redis 生存时间 expire ttl
- EXPIRE
- expire
- Redis Sentinel环境下的Key过期事件消息订阅
- Redis Sentinel环境下的Key过期事件消息订阅
- redis key
- redis -- key
- awk基于固定的字符抽取双引号中的数据
- Qt之进程间通信(共享内存)
- zookeeper的应用和原理
- HBase写性能优化策略
- 区块链是什么
- redis 检查key expire事件
- 利用栈数据结构彻底搞定走迷宫案例解析(并非最短路径)
- 从git上拉取代码后使用 project clean命令也build不通过
- Ros 消息结构1
- Linux C TCP服务器收不到报文
- spring boot获取属性文件内容
- js 作用域、闭包
- JAVA多线程实现的三种方式
- osgEarth矢量瓦片tfs生成建筑案例 4. boston_tfs.earth