Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Publish Command

Redis Publish Command

Redis Publish/Subscribe

The Redis Publish command is used to send a message to the specified channel.

Syntax

The basic syntax of the redis Publish command is as follows:



redis 127.0.0.1:6379> PUBLISH channel message

Available Version

= 2.0.0

Return Value

The number of subscribers that received the message.

Example



redis 127.0.0.1:6379> PUBLISH mychannel "hello, i m here"

(integer) 1

Redis Publish/Subscribe