Back to Redis

PUBSUB NUMPAT

content/commands/pubsub-numpat.md

latest1.5 KB
Original Source

Returns the number of unique patterns that are subscribed to by clients (that are performed using the [PSUBSCRIBE]({{< relref "/commands/psubscribe" >}}) command).

Note that this isn't the count of clients subscribed to patterns, but the total number of unique patterns all the clients are subscribed to.

Cluster note: in a Redis Cluster clients can subscribe to every node, and can also publish to every other node. The cluster will make sure that published messages are forwarded as needed. That said, [PUBSUB]({{< relref "/commands/pubsub" >}})'s replies in a cluster only report information from the node's Pub/Sub context, rather than the entire cluster.

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="pubsub-numpat-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the number of patterns all the clients are subscribed to.

-tab-sep-

Integer reply: the number of patterns all the clients are subscribed to.

{{< /multitabs >}}