当前位置:网站首页>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 .
边栏推荐
猜你喜欢

gsap动画库

Nunjuks template engine

RIP和OSPF的区别和配置命令

强化学习-学习笔记8 | Q-learning

AI 击败了人类,设计了更好的经济机制

4种常见的缓存模式,你都知道吗?

Do you really understand sticky bag and half bag? 3 minutes to understand it

企业展厅设计中常用的三种多媒体技术形式

Tsinghua, Cambridge and UIC jointly launched the first Chinese fact verification data set: evidence-based, covering many fields such as medical society

Charles+drony的APP抓包
随机推荐
The performance and efficiency of the model that can do three segmentation tasks at the same time is better than maskformer! Meta & UIUC proposes a general segmentation model with better performance t
2022年推荐免费在线接收短信平台(国内、国外)
[principle and technology of network attack and Defense] Chapter 6: Trojan horse
静态路由配置
云景网络科技面试题【杭州多测师】【杭州多测师_王sir】
PIP related commands
[principles and technologies of network attack and Defense] Chapter 3: network reconnaissance technology
idea彻底卸载安装及配置笔记
[principle and technology of network attack and Defense] Chapter 1: Introduction
【Unity Shader】插入Pass实现模型遮挡X光透视效果
Download, installation and development environment construction of "harmonyos" deveco
[principle and technology of network attack and Defense] Chapter 7: password attack technology Chapter 8: network monitoring technology
[PaddleSeg源码阅读] PaddleSeg Validation 中添加 Boundary IoU的计算(1)——val.py文件细节提示
Classification of regression tests
Hash, bitmap and bloom filter for mass data De duplication
回归问题的评价指标和重要知识点总结
讨论 | AR 应用落地前,要做好哪些准备?
Kubernetes DevOps CD工具对比选型
【剑指 Offer】59 - I. 滑动窗口的最大值
C语言中匿名的最高境界