PUBSUB NUMPAT
Since 1.1.0Pub/Sub
Syntax
PUBSUB NUMPATReturns how many distinct patterns clients are subscribed to with PSUBSCRIBE. A pattern that several clients subscribe to counts once, as in Redis since 7.0; to see how many subscriptions one connection has, look at the psub= field of CLIENT LIST.
Use it as a cheap check on pattern subscriptions, which cost more than channel subscriptions: every published message is matched against every pattern. It counts this server's subscribers only; in a cluster each node answers for its own clients. See Pub/Sub.
Reply
- The number of patterns;
0if there are none.
Examples
client 2> PSUBSCRIBE n* s*
...
client 3> PSUBSCRIBE n*
...
client 1> PUBSUB NUMPAT
(integer) 2