*PUBSUB SHARDNUMSUB 命令

返回 Sharded Pub/Sub 频道的订阅者数量。Redis 7.0+ 引入。


*语法

PUBSUB SHARDNUMSUB [channel [channel ...]]

*参数说明

参数 类型 必填 说明
channel String 频道名称,可指定多个

*返回值

条件 返回值
有频道 [channel, count, channel, count, ...] 数组

*时间复杂度

O(N)

*

*示例

> PUBSUB SHARDNUMSUB orders notifications
1) "orders"
2) (integer) 3
3) "notifications"
4) (integer) 1

*FAQ

Q: PUBSUB SHARDNUMSUB 和 PUBSUB NUMSUB 有什么区别? A: PUBSUB SHARDNUMSUB 统计 Sharded Pub/Sub 订阅;PUBSUB NUMSUB 统计普通 Pub/Sub 订阅。