本文共 1484 字,大约阅读时间需要 4 分钟。
??-????????????????????????????????????????channel??????????????????????????????????????????
???????????
publish channel message
channel??????????????message??????????????
subscribe channel [channel...]
channel?????????????????????????[channel...]????????????????????????????????????????????????
subscribe?????????????
message??????????
unsubscribe?????????????????
0 ?????????????# ??????? `channel`redis-cli -h 127.0.0.1 publish channel "hello"# ??????? `channel`redis-cli -h 127.0.0.1 publish channel "How are you"
# ???? `channel`redis-cli -h 127.0.0.1 subscribe channel
????????????????????????
# ????1) "subscribe"2) "channel"3) (integer) 11) "message"2) "channel"3) "How are you"
???????????? psubscribe ???????????????
# ????? `*` ?????redis-cli -h 127.0.0.1 psubscribe greets*
??????????????? greets ???????
# ?????????redis-cli -h 127.0.0.1 publish greet1 "hello"redis-cli -h 127.0.0.1 publish greets_1 "hello"redis-cli -h 127.0.0.1 publish greets_2 "world"redis-cli -h 127.0.0.1 publish greets_3 "I am redis"
# ????1) "psubscribe"2) "greets*"3) (integer) 11) "pmessage"2) "greets*"3) "greets_1"4) "hello"1) "pmessage"2) "greets*"3) "greets_2"4) "world"1) "pmessage"2) "greets*"3) "greets_3"4) "I am redis"
?????????????? Redis ??-??????????????
转载地址:http://njkjz.baihongyu.com/