10 redis--频道发布与消息订阅

消息订阅

使用办法:
订阅端: Subscribe 频道名称
发布端: publish 频道名称 发布内容

客户端例子:
redis 127.0.0.1:6379> subscribe news
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "news"
3) (integer) 1
1) "message"
2) "news"
3) "good good study"
1) "message"
2) "news"
3) "day day up"

服务端例子:
redis 127.0.0.1:6379> publish news 'good good study'
(integer) 1
redis 127.0.0.1:6379> publish news 'day day up'
(integer) 1

 

posted @ 2015-02-28 16:40  麦田守望者~  阅读(265)  评论(0编辑  收藏  举报