C# Redis 過期機制不生效問題


引用: 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服務即可讓過期鍵監聽事件生效。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM