PUBSUB NUMSUB
Syntax
PUBSUB NUMSUB [channel [channel ...]]
- Available since:
- 2.8.0
- Time complexity:
- O(N) for the NUMSUB subcommand, where N is the number of requested channels
- ACL categories:
-
@pubsub
,@slow
,
返回指定频道的订阅者数量(不包括订阅模式的客户端)。
请注意,调用此命令时不带通道是有效的。在这种情况下,它将只返回一个空列表。
集群说明:在Redis集群中,客户端可以订阅每个节点,也可以向其他每个节点发布消息。集群将确保根据需要转发发布的消息。也就是说,PUBSUB
在集群中的回复仅报告来自节点的Pub/Sub上下文的信息,而不是整个集群的信息。