美文网首页
REDIS----配置文件----EVENT NOTIFICAT

REDIS----配置文件----EVENT NOTIFICAT

作者: JuMinggniMuJ | 来源:发表于2020-06-06 20:28 被阅读0次

    EVENT NOTIFICATION部分:

    1.说明:
    # Redis can notify Pub/Sub clients about events happening in the key space.
    # This feature is documented at 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:
    #
    # PUBLISH __keyspace@0__:foo del
    # PUBLISH __keyevent@0__:del foo
    

    Redis可以通知Pub/Sub客户端key空间中发生的事件
    例如,如果启用了keyspace事件通知,并且客户端对存储在数据库0中的键“foo”执行DEL操作,则将通过Pub/Sub发布两条消息

    2.监听类型:
    # 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     Keyspace events, published with __keyspace@<db>__ prefix.
    #  E     Keyevent events, published with __keyevent@<db>__ prefix.
    #  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
    #  $     String commands
    #  l     List commands
    #  s     Set commands
    #  h     Hash commands
    #  z     Sorted set commands
    #  x     Expired events (events generated every time a key expires)
    #  e     Evicted events (events generated when a key is evicted for maxmemory)
    #  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.
    

    可以在一组类中选择Redis将通知的事件。每个类都由一个字符标识:
    K key空间事件
    E key事件事件
    g 一般事件
    $ 字符串命令
    l 列表命令
    s 集合命令
    h hash命令
    z 有序集合命令
    x 过期事件
    A 所有事件

    notify-keyspace-events将零个或多个字符组成的字符串作为参数。空字符串表示通知被禁用

    3.配置:
    #  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 ""
    

    默认情况下,所有通知都被禁用,因为大多数用户不需要此功能,而且此功能有一些开销。请注意,如果未指定K或E中的至少一个,则不会传递任何事件

    相关文章

      网友评论

          本文标题:REDIS----配置文件----EVENT NOTIFICAT

          本文链接:https://www.haomeiwen.com/subject/bignzhtx.html