当前位置:网站首页>Redis publishing and subscription
Redis publishing and subscription
2022-07-07 18:48:00 【Gravel under Mount Everest】
What is publish and subscribe
Generally speaking , Publish and subscribe ( also called pub/sub) Is characterized by subscribers (listener) Subscribe to the channel (channel), Publisher (publisher) Responsible for sending binary string messages to channels (binary string message). Whenever a message is sent to a given channel , All subscribers to the channel will receive messages . We can also think of channels as radio stations , Subscribers can listen to multiple stations at the same time , The sender can send messages on any radio station .
Common publish and subscribe commands
| command | meaning |
|---|---|
| subscribe | subscribe channel [channel …]---- Subscribe to a given channel or channels |
| unsubscribe | unsubscribe channel [channel…]---- Unsubscribe from a given channel or channels , If no channel is given at the time of execution , Then unsubscribe all channels |
| publish | pushlish channel [channel …]— Send a message to a given channel |
| psubscribe | psubscribe pattern [pattern…]— Subscribe to all channels that match the given pattern |
| punsubscribe | punsubscribe pattern [pattern …]— Unsubscribe from the given mode , If no mode is given at the time of execution , Then unsubscribe from all modes |
Rarely used Redis The reason for publishing and subscribing to
- Reason one and redis The stability of the system . For the old version Redis Come on , If a client subscribes to one or more channels , But it doesn't read messages fast enough , Then the continuous backlog of information will make Redis The volume of the output buffer becomes larger and larger , This may lead to Redis It's slowing down , Even the immediate collapse . It can also lead to Redis Killed by the operating system , Even the operating system itself is not available . new edition Redis There won't be such a problem , Because it will automatically disconnect the nonconformity client-output-buffer-limitpubsub Subscription clients required by configuration options .
- The second reason is related to the reliability of data transmission . Any network system may encounter disconnection during operation , The continuous error caused by disconnection usually causes one end of the two ends of the network connection to reconnect . however , If the client is disconnected during the subscription operation , Then the client will lose all messages sent during the disconnection .
边栏推荐
- 低代码助力企业数字化转型会让程序员失业?
- Yearning-SQL审核平台
- 【蓝桥杯集训100题】scratch从小到大排序 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第17题
- CVPR 2022丨学习用于小样本语义分割的非目标知识
- Comparison and selection of kubernetes Devops CD Tools
- 企业展厅设计中常用的三种多媒体技术形式
- [demo] circular queue and conditional lock realize the communication between goroutines
- Charles+drony的APP抓包
- 体总:安全有序恢复线下体育赛事,力争做到国内赛事应办尽办
- nest.js入门之 database
猜你喜欢

More than 10000 units were offline within ten days of listing, and the strength of Auchan Z6 products was highly praised

Year SQL audit platform

AI defeated mankind and designed a better economic mechanism

Summary of debian10 system problems

Wireshark analyzes packet capture data * cap
![[principles and technologies of network attack and Defense] Chapter 5: denial of service attack](/img/18/ac8b4c0dba4dd972df119d2f670416.png)
[principles and technologies of network attack and Defense] Chapter 5: denial of service attack

go语言的字符串类型、常量类型和容器类型

磁盘存储链式的B树与B+树
![[tpm2.0 principle and Application guide] Chapter 5, 7 and 8](/img/38/93fd986916193803bbd90805f832fa.png)
[tpm2.0 principle and Application guide] Chapter 5, 7 and 8

Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
随机推荐
PIP related commands
What is the general yield of financial products in 2022?
Rules for filling in volunteers for college entrance examination
单臂路由和三层交换的简单配置
低代码助力企业数字化转型会让程序员失业?
Tear the Nacos source code by hand (tear the client source code first)
手撕Nacos源码(先撕客户端源码)
Debian10 compile and install MySQL
线程池的拒绝策略
将模型的记忆保存下来!Meta&UC Berkeley提出MeMViT,建模时间支持比现有模型长30倍,计算量仅增加4.5%...
线程池和单例模式以及文件操作
[principle and technology of network attack and Defense] Chapter 7: password attack technology Chapter 8: network monitoring technology
学习open62541 --- [67] 添加自定义Enum并显示名字
Idea completely uninstalls installation and configuration notes
财富证券证券怎么开户?通过链接办理股票开户安全吗
面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
【demo】循环队列及条件锁实现goroutine间的通信
2022年理财有哪些产品?哪些适合新手?
静态路由配置
Save the memory of the model! Meta & UC Berkeley proposed memvit. The modeling time support is 30 times longer than the existing model, and the calculation amount is only increased by 4.5%