Redis SUBSCRIBE指令

2019-10-16 22:51:31

Redis SUBSCRIBE命令所預訂客戶的指定的通道。

語法

Redis SUBSCRIBE命令基本語法如下所示:

redis 127.0.0.1:6379> SUBSCRIBE channel [channel ...]

返回值

返回陣列

例子

redis 127.0.0.1:6379> SUBSCRIBE mychannel 
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "mychannel"
3) (integer) 1
1) "message"
2) "mychannel"
3) "a"