当前位置:网站首页>Redis 发布和订阅
Redis 发布和订阅
2022-07-04 13:30:00 【BugMaker-shen】
Redis 发布订阅 (pub/sub) 是一种消息通信模式:发送者 (pub) 发送消息,订阅者 (sub) 接收消息
Redis 客户端可以订阅任意数量的频道
Redis的发布和订阅
(1)客户端可以订阅频道如下图

(2)当给这个频道发布消息后,消息就会发送给订阅的客户端
发布订阅命令行实践
(1)打开一个客户端订阅channel1
SUBSCRIBE channel1

(2)打开另一个客户端,给channel1发布消息hello
publish channel1 hello

注:返回的1是订阅者数量
(3)打开第一个客户端可以看到发送的消息

注:发布的消息没有持久化,如果在订阅的客户端收不到hello,只能收到订阅后发布的消息
边栏推荐
- C language set operation
- leetcode:6110. The number of incremental paths in the grid graph [DFS + cache]
- Deep learning 7 transformer series instance segmentation mask2former
- SAIC Maxus officially released its new brand "mifa", and its flagship product mifa 9 was officially unveiled!
- 函数计算异步任务能力介绍 - 任务触发去重
- Digi restarts XBee Pro S2C production. Some differences need to be noted
- LeetCode 1200 最小绝对差[排序] HERODING的LeetCode之路
- Xcode abnormal pictures cause IPA packet size problems
- Docker compose public network deployment redis sentinel mode
- (1)性能调优的标准和做好调优的正确姿势-有性能问题,上HeapDump性能社区!
猜你喜欢

Nowcoder rearrange linked list

IO流:节点流和处理流详细归纳。

LVGL 8.2 LED

(1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!

The performance of major mainstream programming languages is PK, and the results are unexpected

Scratch Castle Adventure Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022

How to build a technical team that will bring down the company?

Digi重启XBee-Pro S2C生产,有些差别需要注意

阿里被裁员工,找工作第N天,猎头又传来噩耗...

Opencv learning notes - linear filtering: box filtering, mean filtering, Gaussian filtering
随机推荐
Count the running time of PHP program and set the maximum running time of PHP
LVGL 8.2 keyboard
LVGL 8.2 Line
Opencv learning notes - linear filtering: box filtering, mean filtering, Gaussian filtering
局部修改-渐进型开发
Ultrasonic distance meter based on 51 single chip microcomputer
Industrial Internet has greater development potential and more industry scenarios
程序员自曝接私活:10个月时间接了30多个单子,纯收入40万
Red envelope activity design in e-commerce system
remount of the / superblock failed: Permission denied
92. (cesium chapter) cesium building layering
Comment configurer un accord
Nowcoder rearrange linked list
Digi重启XBee-Pro S2C生产,有些差别需要注意
Respect others' behavior
深度学习 神经网络的优化方法
Transplant tinyplay for imx6q development board QT system
Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow
(1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!
Detailed analysis of pytorch's automatic derivation mechanism, pytorch's core magic