当前位置:网站首页>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 .
边栏推荐
- How to clean when win11 C disk is full? Win11 method of cleaning C disk
- Sports Federation: resume offline sports events in a safe and orderly manner, and strive to do everything possible for domestic events
- C语言中匿名的最高境界
- AI 击败了人类,设计了更好的经济机制
- Tips for this week 140: constants: safety idioms
- Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
- Is it safe to open an online futures account now? How many regular futures companies are there in China?
- 手撕Nacos源码(先撕客户端源码)
- [principle and technology of network attack and Defense] Chapter 6: Trojan horse
- [unity shader] insert pass to realize the X-ray perspective effect of model occlusion
猜你喜欢
随机推荐
4种常见的缓存模式,你都知道吗?
同消费互联网的较为短暂的产业链不同,产业互联网的产业链是相当漫长的
云景网络科技面试题【杭州多测师】【杭州多测师_王sir】
Afghan interim government security forces launched military operations against a hideout of the extremist organization "Islamic state"
Summary of debian10 system problems
卖空、加印、保库存,东方甄选居然一个月在抖音卖了266万单书
Tear the Nacos source code by hand (tear the client source code first)
保证接口数据安全的10种方案
Wireshark analyzes packet capture data * cap
线程池中的线程工厂
不能忽略的现货白银短线操作小技巧
万字保姆级长文——Linkedin元数据管理平台Datahub离线安装指南
【demo】循环队列及条件锁实现goroutine间的通信
直播预约通道开启!解锁音视频应用快速上线的秘诀
【剑指 Offer】59 - I. 滑动窗口的最大值
3分钟学会制作动态折线图!
伺服力矩控制模式下的力矩目标值(fTorque)计算
Win11C盘满了怎么清理?Win11清理C盘的方法
回归测试的分类
Simple configuration of single arm routing and layer 3 switching


![[C language] string function](/img/6c/c77e8ed5bf383b7c656f45b361940f.png)






