redis PUBSUB command
Translation results:
pub
UK[pʌb] 美[pʌb]
n.Pub, hotel; inn
plural: pubs
sub
英[sʌb] 美[sʌb]
n. Submarine; substitute, substitute, substitute; subway; reviewer Member
vi.Be a stand-in, be a substitute player; be a stand-in, proofread (manuscript)
Third person singular: subs Plural: subs Present participle: subbing Past tense: subbed Past participle: subbed
redis PUBSUB commandsyntax
Function:PUBSUB is an introspection command for viewing the status of subscription and publishing systems. It consists of several subcommands in different formats.
Syntax: PUBSUB <subcommand> [argument [argument ...]]
Available versions: >= 2.8.0
Time complexity: O(N), N is the number of active channels (for shorter channels and patterns, the complexity of pattern matching is treated as a constant).
Returns: A list of active channels.
redis PUBSUB commandexample
# client-1 订阅 news.it 和 news.sport 两个频道 client-1> SUBSCRIBE news.it news.sport Reading messages... (press Ctrl-C to quit) 1) "subscribe" 2) "news.it" 3) (integer) 1 1) "subscribe" 2) "news.sport" 3) (integer) 2 # client-2 订阅 news.it 和 news.internet 两个频道 client-2> SUBSCRIBE news.it news.internet Reading messages... (press Ctrl-C to quit) 1) "subscribe" 2) "news.it" 3) (integer) 1 1) "subscribe" 2) "news.internet" 3) (integer) 2 # 首先, client-3 打印所有活跃频道 # 注意,即使一个频道有多个订阅者,它也只输出一次,比如 news.it client-3> PUBSUB CHANNELS 1) "news.sport" 2) "news.internet" 3) "news.it" # 接下来, client-3 打印那些与模式 news.i* 相匹配的活跃频道 # 因为 news.sport 不匹配 news.i* ,所以它没有被打印 redis> PUBSUB CHANNELS news.i* 1) "news.internet" 2) "news.it"