subscribe
UK[s?b?skra?b] US[s?b?skra?b]
vt.& vi. Subscription; pledge, donation; signature, inscription, signature; subscription, Order
Third person singular: subscribes Present participle: subscribing Past tense: subscribed Past participle: subscribed
redis SUBSCRIBE command syntax
Function:Subscribe to the information of one or more given channels.
Syntax: SUBSCRIBE channel [channel ...]
Available versions: >= 2.0.0
Time complexity: O(N), where N is the number of subscribed channels.
Return: The information received.
redis SUBSCRIBE command example
# 訂閱 msg 和 chat_room 兩個(gè)頻道 # 1 - 6 行是執(zhí)行 subscribe 之后的反饋信息 # 第 7 - 9 行才是接收到的第一條信息 # 第 10 - 12 行是第二條 redis> subscribe msg chat_room Reading messages... (press Ctrl-C to quit) 1) "subscribe" # 返回值的類(lèi)型:顯示訂閱成功 2) "msg" # 訂閱的頻道名字 3) (integer) 1 # 目前已訂閱的頻道數(shù)量 1) "subscribe" 2) "chat_room" 3) (integer) 2 1) "message" # 返回值的類(lèi)型:信息 2) "msg" # 來(lái)源(從那個(gè)頻道發(fā)送過(guò)來(lái)) 3) "hello moto" # 信息內(nèi)容 1) "message" 2) "chat_room" 3) "testing...haha"