redis发布订阅

一、解释

进程间的一中消息通信模式:发送者(pub) 订阅者(sub)接收消息。

二、用法

先订阅后发布才能接受到消息
1.可以一次性订阅多个:subscribe c1 c2 c3

2.消息发布:publish c2 hello-redis

3.订阅多个,通配符*:psubscribe new*

4.接受消息:publish new1 redis2015

  

关注我的公众号,精彩内容不能错过

原文地址:https://www.cnblogs.com/huanchupkblog/p/7228561.html