当前位置: 移动技术网 > IT编程>数据库>MongoDB > C# Redis 过期机制不生效问题

C# Redis 过期机制不生效问题

2018年09月19日  | 移动技术网IT编程  | 我要评论

引用: https://ask.csdn.net/questions/358802 根据这里的代码写出监听事件后,事件并没有生效

在比对了多次配置文件后,终于发现了一点蹊跷,在配置中不能有与之相冲的配置,于是处理方法就很简单了。

将无关监听事件注释,再把自己需要的取消注释,即可让监听事件生效

#  the "notify-keyspace-events" takes as argument a string that is composed
#  of zero or multiple characters. the empty string means that notifications
#  are disabled.
#
#  example: to enable list and generic events, from the point of view of the
#           event name, use:
#
#  notify-keyspace-events elg #被注释的代码
#
#  example 2: to get the stream of the expired keys subscribing to channel
#             name __keyevent@0__:expired use:
#
#被取消注释的代码 notify-keyspace-events ex  

保存配置后,重启redis服务即可让过期键监听事件生效。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网