整个系列的目录: Redis 5.0.3 配置文件详解(易读-白话翻译)-目录    

############################# EVENT NOTIFICATION ##############################
# 下面的条件说明很多看上去挺复杂的,其实很简单:就是多个字符代表的意思组合到一起而已
# Redis can notify Pub/Sub clients about events happening in the key space.
# This feature is documented at http://redis.io/topics/notifications
# Redis可以将关于"键空间(简单理解为Hash表中的键值对)"发生的事件以通知的形式发送给Pub/Sub客户端
# 更详细的请参考Redis的官方文档:http://redis.io/topics/notifications
#
# For instance if keyspace events notification is enabled, and a client
# performs a DEL operation on key "foo" stored in the Database 0, two
# messages will be published via Pub/Sub:
# 如果通过配置开启了键空间和键时间的通知,如果通过客户端在第0号database上执行一个DEL foo操作,那么会
# 发布两条消息
# PUBLISH __keyspace@0__:foo del
# PUBLISH __keyevent@0__:del foo
#
# It is possible to select the events that Redis will notify among a set
# of classes. Every class is identified by a single character:
# 我们可以通过组合下面的分类将事件通知发给客户端
#  "K"和"E"代表两大类,无论怎么组合,必须有其中一个,可以两个同时选择,K代表Keyspace事件,E代表Keyevent事件
#  K以为着一个或多个数据类型的所有符合规则事件都会生成通知
#  E以为着一个或多个数据类型的某一个命令的时间会生成通知
#  如果看到这里还没明白,建议去百度一下,推荐一个:http://redisdoc.com/topic/notification.html#id1
#  K     Keyspace events, published with __keyspace@<db>__ prefix.
#  E     Keyevent events, published with __keyevent@<db>__ prefix.
#
#  一般的命令,比如DEL SET EXPIRE RENAME等等,感觉像是所有会产生改变的命令都符合条件
#  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
#
#  下面的$ l s h z 分别代表大家都知道5种数据类型
#  $     String commands
#  l     List commands
#  s     Set commands
#  h     Hash commands
#  z     Sorted set commands
#
#  x 代表过期事件  e 代表内存使用超过maxmemory时KEY被淘汰的事件
#  x     Expired events (events generated every time a key expires)
#  e     Evicted events (events generated when a key is evicted for maxmemory)
#
#  A 是一个别名,代表了"g$lshzxe"的组合,可以增强阅读性
#  A     Alias for g$lshzxe, so that the "AKE" string means all the events.
#
#  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.
#  可以给"notify-keyspace-events"设置0或者多个字符,如果设置为空字符串,则表示关闭此功能
#
#  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
#
#  By default all notifications are disabled because most users don't need
#  this feature and the feature has some overhead. Note that if you don't
#  specify at least one of K or E, no events will be delivered.
#  因为开启此功能是有一定开销的,会影响性能,而且大多数用户不需要此功能,所以默认是关闭了此功能的,不会有事件通知被发送
notify-keyspace-events ""
09-01 21:33