发布订阅

角色

发布者 publisher
订阅者 subscriber
频道 channel

模型

12. redis发布订阅功能
订阅者只会收到订阅频道的消息
一个订阅者可以订阅多个频道
频道所有的订阅者都可以收到消息
订阅者获取不到频道的历史消息

API

api 说明
publish channel message 发送消息到某个频道,返回的结果是该频道的订阅者数量
subscribe [channel] 订阅一个或多个频道
unsubscribe [channel] 取消订阅一个或多个频道
psubscribe [pattern] 按照模式订阅频道
punsubscribe [pattern] 按照模式取消订阅频道
pubsub channels 列出至少有一个订阅者的频道
pubsub numbers [channel…] 列出给定频道的订阅数量
pubsub numpat 列出被订阅模式的数量

相关文章:

  • 2022-01-06
  • 2021-07-06
  • 2018-08-08
  • 2018-08-18
  • 2021-04-14
  • 2021-07-23
猜你喜欢
  • 2022-01-29
  • 2021-07-04
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-10-13
  • 2022-03-06
相关资源
相似解决方案