SPUBLISH

SPUBLISH

SPUBLISH shardchannel message
Available since
7.0.0
Time complexity
O(N) where N is the number of clients subscribed to the receiving shard channel.
ACL categories
@pubsub, @fast

Posts a message to the given shard channel.

In Redict Cluster, shard channels are assigned to slots by the same algorithm used to assign keys to slots. A shard message must be sent to a node that own the slot the shard channel is hashed to. The cluster makes sure that published shard messages are forwarded to all the node in the shard, so clients can subscribe to a shard channel by connecting to any one of the nodes in the shard.

For more information about sharded pubsub, see Sharded Pubsub.

Examples #

For example the following command publish to channel orders with a subscriber already waiting for message(s).

> spublish orders hello
(integer) 1

Redict logo courtesy of @janWilejan, CC-BY-SA-4.0. Download SVG ⤑

Portions of this website courtesy of Salvatore Sanfilippo, CC-BY-SA-4.0.