redis 发布订阅
作者:互联网
Redis 通过 PUBLISH 、 SUBSCRIBE 等命令实现了订阅与发布模式。
从机制来看,pub/sub的机制更像是一个广播系统。多个subscriber可以订阅多个channel,多个publisher也可以往多个channel中发布消息。
订阅和发布 操作
PUBLISHE channel 123 # 将信息 123 发送到指定的频道 channel SUBSCRIBE channel1 channel2 channel3 #订阅频道,可以同时订阅多个频道 UNSUBSCRIBE channel1 #取消订阅指定的频道, 如果不指定频道,则会取消订阅所有频道 PSUBSCRIBE python* #正则匹配
标签:订阅,频道,多个,redis,channel1,发布,123,channel 来源: https://www.cnblogs.com/kevin6/p/11799501.html