当前位置:网站首页>Redis publishing and subscription
Redis publishing and subscription
2022-07-19 08:27:00 【Illusory clarity】
1. What is publish and subscribe
Redis Publish subscribe (pub/sub) It's a message communication mode : sender (pub) Send a message , subscriber (sub) receive messages . Redis Clients can subscribe to any number of channels .
2. Redis Publish and subscribe to
1、 The client can subscribe to channels, as shown in the figure below
A client can subscribe to multiple channels .
2、 When you post a message to this channel , The message is sent to the subscribing client 
3. Publish and subscribe command line implementation
1、 Open a client subscription channel1
SUBSCRIBE channel1

2、 Open another client , to channel1 Release the news hello
publish channel1 hello

Back to 1 Is the number of subscribers
3、 Open the first client to see the sent message 
notes :
Published messages are not persistent , If the subscription client does not receive hello, Only messages published after subscription can be received
边栏推荐
- Excellent résumé! Enfin quelqu'un a compris toutes les connexions SQL
- 数据库写入优化:分库分表及相关问题
- OpenFeign服务接口调用
- Visual studio production environment configuration scheme: slowcheetah
- TextView文字上下移动
- 畅玩JVM——关于GC垃圾回收必须要掌握的知识
- Great summary! Finally, someone explained all kinds of SQL join connections clearly
- 5.1 vulnérabilités et précautions en matière de sécurité
- Redis cache avalanche, penetration, breakdown
- leetcode:287. Find the repetition number [fast and slow pointer board]
猜你喜欢

812. Maximum triangle area

Dependency injection method

Enjoy JVM -- knowledge about GC garbage collection

Detailed explanation of ansible automatic operation and maintenance (IV) preparation, use, command execution and example demonstration of playbook in ansible

Redis cache avalanche, penetration, breakdown

数组习题三

Detailed explanation of type, user-defined type, preliminary understanding of structure

1. Flask Foundation

Great summary! Finally, someone explained all kinds of SQL join connections clearly

Deep learning 7 deep feedforward network 2
随机推荐
Redis6新数据类型——HyperLogLog
The core problem of concurrent programming
QT related problems encountered when writing code
如何在 Jenkins Pipeline 中使用curl 并处理响应结果
依赖注入方式
Eureka基础知识
Set settings in vscode json
Deep learning 7 deep feedforward network 2
Real case: how to check the soaring usage of CPU after the system goes online?
Redis的发布和订阅
How to select MCU?
Viewing the technology stack of distributed system from the crash report of station B
写代码遇到Qt相关问题
openpyxl跨工作簿复制sheet页
MCU如何选型?
超干货!彻底搞懂Golang内存管理和垃圾回收
C#对txt文件的读写操作
Redis cluster
Enjoy JVM -- knowledge about GC garbage collection
be vigilant! Another phishing attack: uniswap stolen $8.1 million