SPUBLISH
SPUBLISH shardchannel message
- Group
- Pub/Sub
- Complexity
- O(N) where N is the number of subscribers
- Arity
- 3 (exactly, counting the command name)
- Flags
- pubsub, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
SPUBLISH delivers message to every connection subscribed to the shard
channel with SSUBSCRIBE. In a cluster the command is
routed like a key to the shard that serves the channel’s slot, and the message
reaches subscribers on that shard’s nodes only. Pattern subscriptions do not
receive shard channel messages.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Integer: the number of subscribers on this node that received the message | Integer |
Examples
Section titled “Examples”127.0.0.1:6379> SPUBLISH orders:{eu} "order 1001 placed"(integer) 1Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”SSUBSCRIBE, PUBLISH, PUBSUB SHARDNUMSUB
In a cluster: Keys, slots and commands in a cluster
Was this page helpful?
Thanks for the feedback.