redis 发布和订阅

发布和订阅

发布

publish channel message
例如:
publish news “todays news”
127.0.0.1:6379> publish news "today is sunshine"
(integer) 0
127.0.0.1:6379> publish news "today is sunshine1"
(integer) 1
127.0.0.1:6379> publish yes "yes yes yes"
(integer) 0
127.0.0.1:6379> publish news "today is sunshine1 yes"
(integer) 2
127.0.0.1:6379> publish news "today is sunshine1 yes 2"
(integer) 3
127.0.0.1:6379> publish yes "today is sunshine1 yes 2"
(integer) 1
127.0.0.1:6379> publish yes "today is sunshine1 yes 23"
(integer) 1

订阅

subscribe channel
例如:
subscribe news
127.0.0.1:6379> subscribe news
上一篇:RabbitMQ-Java实现Publish/Subscribe订阅模式


下一篇:c# – log4net在发布到服务器时无法创建日志文件