标签:sch logs docker test str bsp 地址 pre caching
进入redis中
docker run -it redis:latest redis-cli -h 192.168.28.56 (本机的ip地址)
以下实例演示了发布订阅是如何工作的。在我们实例中我们创建了订阅频道名为 redisChat:
redis 127.0.0.1:6379> SUBSCRIBE redisChat(这是是订阅的名称)
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "redisChat"
3) (integer) 1
现在,我们先重新开启个 redis 客户端,然后在同一个频道 redisChat 发布两次消息,订阅者就能接收到消息。
redis 127.0.0.1:6379> PUBLISH redisChat "Redis is a great caching technique"
(integer) 1
redis 127.0.0.1:6379> PUBLISH redisChat "Learn redis by runoob.com"
(integer) 1
# 订阅者的客户端会显示如下消息
1) "message"
2) "redisChat"
3) "Redis is a great caching technique"
1) "message"
2) "redisChat"
3) "Learn redis by runoob.com"
转载:https://www.cnblogs.com/stj123/p/10759074.html
标签:sch logs docker test str bsp 地址 pre caching
原文地址:https://www.cnblogs.com/djj123/p/11017497.html