pubsub-shardnumsub.3valkey - Man Page

Returns the count of subscribers of shard channels.

Synopsis

PUBSUB SHARDNUMSUB shardchannel [shardchannel...]

Description

Returns the number of subscribers for the specified shard channels.

Note that it is valid to call this command without channels, in this case it will just return an empty list.

Cluster note: in a Valkey Cluster, PUBSUB’s replies in a cluster only report information from the node’s Pub/Sub context, rather than the entire cluster.

Reply

valkey-protocol(7) Array reply: the number of subscribers per shard channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers.

Complexity

O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels

Acl Categories

@pubsub @slow

History

Examples

> PUBSUB SHARDNUMSUB orders
1) "orders"
2) (integer) 1

See Also

psubscribe(3valkey), publish(3valkey), pubsub(3valkey), pubsub-channels(3valkey), pubsub-help(3valkey), pubsub-numpat(3valkey), pubsub-numsub(3valkey), pubsub-shardchannels(3valkey), punsubscribe(3valkey), spublish(3valkey), ssubscribe(3valkey), subscribe(3valkey), sunsubscribe(3valkey), unsubscribe(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual