Latest web development tutorials

Redis Publish command

Redis publish and subscribe

Redis Publish command is used to send information to a specified channel.

grammar

redis Publish basic command syntax is as follows:

redis 127.0.0.1:6379> PUBLISH channel message

Available versions

> = 2.0.0

return value

The number of subscribers receiving the information.

Examples

redis 127.0.0.1:6379> PUBLISH mychannel "hello, i m here"
(integer) 1

Redis publish and subscribe