流沙团
redis订阅
2021-8-27 流沙团


PUBLISH channel msg


将信息 message 发送到指定的频道 channel


SUBSCRIBE channel [channel ...]


订阅频道,可以同时订阅多个频道


UNSUBSCRIBE [channel ...]


取消订阅指定的频道, 如果不指定频道,则会取消订阅所有频道


PSUBSCRIBE pattern [pattern ...]


订阅一个或多个符合给定模式的频道,每个模式以 * 作为匹配符,比如 it* 匹配所    有以 it 开头的频道( it.news 、 it.blog 、 it.tweets 等等), news.* 匹配所有    以 news. 开头的频道( news.it 、 news.global.today 等等),诸如此类


PUNSUBSCRIBE [pattern [pattern ...]]


退订指定的规则, 如果没有参数则会退订所有规则


PUBSUB subcommand [argument [argument ...]]


查看订阅与发布系统状态


注意:使用发布订阅模式实现的消息队列,当有客户端订阅channel后只能收到后续发布到该频道的消息,之前发送的不会缓存,必须Provider和Consumer同时在线。

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容