PUBSUB NUMPAT
PUBSUB NUMPAT
- Group
- Pub/Sub
- Complexity
- O(N) where N is the number of subscribed patterns
- Arity
- 2 (exactly, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
PUBSUB NUMPAT returns how many pattern subscriptions, made with
PSUBSCRIBE, exist on this node. Each connection’s
subscription counts: two connections subscribed to the same pattern count as
two.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Integer | Integer |
Examples
Section titled “Examples”With one connection subscribed to news.* and another to news.* and
alerts.*:
127.0.0.1:6379> PUBSUB NUMPAT(integer) 3Compatibility
Section titled “Compatibility”Redis 7 and Valkey 8 count distinct patterns instead, so in the example above
they would reply 2. The reply is the same when no pattern is shared between
connections.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.