当前位置:网站首页>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,只能收到订阅后发布的消息
边栏推荐
- Five minutes per day machine learning: use gradient descent to complete the fitting of multi feature linear regression model
- Data Lake (13): spark and iceberg integrate DDL operations
- numpy笔记
- 10. (map data) offline terrain data processing (for cesium)
- [information retrieval] link analysis
- 现代控制理论入门+理解
- LVGL 8.2 List
- LVGL 8.2 Sorting a List using up and down buttons
- Details of FPGA underlying resources
- Openresty current limiting
猜你喜欢
Codeforce:c. sum of substrings
Test evaluation of software testing
Implementation of macro instruction of first-order RC low-pass filter in signal processing (easy touch screen)
Introduction to asynchronous task capability of function calculation - task trigger de duplication
Leetcode 1200 minimum absolute difference [sort] The Path of leetcode for heroding
Is BigDecimal safe to calculate the amount? Look at these five pits~~
LVGL 8.2 Line wrap, recoloring and scrolling
No servers available for service: xxxx
Red envelope activity design in e-commerce system
Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
随机推荐
Summary of common problems in development
PLC Analog input analog conversion FC s_ ITR (CoDeSys platform)
Leetcode t47: full arrangement II
Openresty redirection
LVGL 8.2 Line
智能客服赛道:网易七鱼、微洱科技打法迥异
[C language] Pointer written test questions
Details of FPGA underlying resources
92. (cesium chapter) cesium building layering
[information retrieval] link analysis
LeetCode 1200 最小絕對差[排序] HERODING的LeetCode之路
Xcode abnormal pictures cause IPA packet size problems
关于miui12.5 红米k20pro用au或者povo2出现问题的解决办法
C language course design questions
Leetcode t49: grouping of alphabetic words
Pandora IOT development board learning (RT thread) - Experiment 3 button experiment (learning notes)
Nowcoder rearrange linked list
软件测试之测试评估
LVGL 8.2 Sorting a List using up and down buttons
A collection of classic papers on convolutional neural networks (deep learning classification)