当前位置:网站首页>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 .
边栏推荐
- 『HarmonyOS』DevEco的下载安装与开发环境搭建
- [trusted computing] Lesson 13: TPM extended authorization and key management
- 4种常见的缓存模式,你都知道吗?
- Nunjuks template engine
- Introduction de l'API commune de programmation de socket et mise en œuvre de socket, select, Poll et epoll
- Introduction of common API for socket programming and code implementation of socket, select, poll, epoll high concurrency server model
- [trusted computing] Lesson 10: TPM password resource management (II)
- 高考填志愿规则
- Chapter 3 business function development (safe exit)
- Simple configuration of single arm routing and layer 3 switching
猜你喜欢
随机推荐
小试牛刀之NunJucks模板引擎
sqlite sql 异常 near “with“: syntax error
[paddleseg source code reading] add boundary IOU calculation in paddleseg validation (1) -- val.py file details tips
Will domestic software testing be biased
Hutool - 轻量级 DB 操作解决方案
Tips for this week 131: special member functions and ` = Default`
2022年推荐免费在线接收短信平台(国内、国外)
The report of the state of world food security and nutrition was released: the number of hungry people in the world increased to 828million in 2021
讨论| 坦白局,工业 AR 应用为什么难落地?
单臂路由和三层交换的简单配置
云安全日报220707:思科Expressway系列和网真视频通信服务器发现远程攻击漏洞,需要尽快升级
[PaddleSeg源码阅读] PaddleSeg Validation 中添加 Boundary IoU的计算(1)——val.py文件细节提示
[unity shader] insert pass to realize the X-ray perspective effect of model occlusion
体总:安全有序恢复线下体育赛事,力争做到国内赛事应办尽办
[Tawang methodology] Tawang 3W consumption strategy - U & a research method
标准ACL与扩展ACL
Introduction of common API for socket programming and code implementation of socket, select, poll, epoll high concurrency server model
同消费互联网的较为短暂的产业链不同,产业互联网的产业链是相当漫长的
【demo】循环队列及条件锁实现goroutine间的通信
Improve application security through nonce field of play integrity API