当前位置:网站首页>Redis usage scenario sharing (project practice)
Redis usage scenario sharing (project practice)
2022-06-22 21:34:00 【Chen Xi should work hard】
【 Chen Xi has to work hard 】:hello Hello, I'm Chen Xi , I'm glad you came to read , Nickname is the hope that you can constantly improve , Moving forward to good programmers !
The blog comes from the project and the summary of the problems encountered in programming , Occasionally there are books to share , I'll keep updating Java front end 、 backstage 、 database 、 Project cases and other related knowledge points summary , Thank you for your reading and attention , I hope my blog can help more people , Share and gain new knowledge , Make progress together !
We quarryers , The heart of a cathedral , May we go in our own love …
One 、 Application scenarios
Redis The use of is to ease the high and send MySQL The pressure !
quote Redis after , The first query MySQL, Store data synchronization in Redis in , Subsequent queries can directly query the cache 
I share my B Application scenarios in end products !
For example, a merchant inquires about the sales volume of its own store , sales volumes , Customer unit price , Gross profit margin and other data !
- Base date data : Like today 2022-06-10 So the benchmark time is 2022-06-09( The day before )
- Underlying data logic : The underlying data is not simply queried , For example, sales volume involves function calculation , Gross profit margin is calculated in the business code

After querying the corresponding data, store it in Redis in , Follow up directly from Redis Take it
About Redis and MySQL Analysis of data consistency in this scenario
Real business scenarios : Before today's Day , For example, before eight o'clock , The sales data of the previous day will be synchronized to our database table , And it won't change ! At the same time, the deadline for sales data that can be queried today is the previous day ( Financial day ). So no matter how many times MySQL and Redis The data are the same !( because MySQL Business data will not change ); Introduce... Here Redis The interface speed is greatly optimized !
Two 、 Application effect
Original logic : service layer Encapsulation method 1,2,3 return result Cache database not used
Present logic : service layer Check cache , There are direct returns in the cache ( Only the first time you need to query MySQL) Use the cache database 
Graphic, : introduce Redis After caching, it is obvious that the execution logic of the corresponding interface is shortened , And greatly shorten 
Real business sharing
What we're doing right now B End business , A one-time query may involve more than a dozen fields , Add the year-on-year and month on month calculations , The access request of an interface may be about 2-3S; If the cache database is used, it can be directly optimized to 0.1-0.2S;
B End products +C End products
What we're doing right now B The end product mainly means that the merchant can see the sales data , Focus on querying specific data , Businesses are more concerned about whether the data queried is correct , Therefore, there are many query fields in business , Interface access is slow , At present, the average number of first-time queries is 2-3S, But such a scenario is understandable for businesses !
- B End products , Also called To B(To Business) product , That is, enterprise level products for enterprises or specific user groups ;
- C End products , Also called To C(To Customer) product , That is, products for ordinary consumers .
- B Focus on function ,C Focus on experience .
3、 ... and 、 Related expansion
Share what you have sorted out before Redis Related knowledge , Welcome to punch in 、 communicate 、 communication !
- Read Redis Master slave architecture 、 Sentinel mode 、 colony
- Read Redis Persistence mechanism
- Redis Cache breakdown 、 Cache penetration 、 Cache avalanche principle and solution
- Redis Data type String Application scenarios of
- Redis Detailed explanation of basic interview knowledge
Thank you very much for reading here , If this article helps you , I hope I can leave your praise Focus on ️ Share Leaving a message. thanks!!!
May we go in our own love !
边栏推荐
- 2022危险化学品经营单位主要负责人上岗证题库及模拟考试
- 2022年山东省安全员C证考试试题模拟考试平台操作
- 牛客 52次月赛 C 说谎的机器 (区间赋值操作由O(n^2)转为O(n)的复杂度)
- 快速排序模板 & 注意事项
- Correspondence between int and char in C language
- 92 match for several_ Recognize SQL write example
- Baijia forum Daqin rise (lower part)
- 鸿蒙第三次培训
- 2022年A特种设备相关管理(电梯)考题及模拟考试
- 第033讲:异常处理:你不可能总是对的2 | 课后测试题及答案
猜你喜欢

One line of code binds swiftui view animation for a specific state

杰理之开启四声道通话近端卡顿问题【篇】
![[redis] profile](/img/1c/05c06d59c9efb5983f877822db333c.png)
[redis] profile

2022 chemical automation control instrument examination exercises and online simulation examination
![kali2021安装RTL8188GU无线网卡[TL-WN726N]驱动](/img/29/8dd188cc4e909562862b5f2c57c898.png)
kali2021安装RTL8188GU无线网卡[TL-WN726N]驱动
![[cm11 linked list splitting]](/img/66/6ac3f78db20ec7f177b88c88028dde.png)
[cm11 linked list splitting]

杰理之外挂 4M 的 flash 在 PC 上查看大小只有 1M 的处理方法【篇】
![[redis]redis6 master-slave replication](/img/47/3be33a0d7435bd75cdd6e7b4ea51d4.png)
[redis]redis6 master-slave replication

Redis的使用场景分享(项目实战)

CVPR2022 | 海德堡大学《深度视觉相似性与度量学习》教程
随机推荐
[876. intermediate node of linked list]
万字长文 | 使用 RBAC 限制对 Kubernetes 资源的访问
杰理之使用 DP 和 DM 做 IO 按键检测注意点【篇】
第022讲:函数:递归是神马 | 课后测试题及答案
[redis]Redis6的主从复制
2022年A特种设备相关管理(电梯)考题及模拟考试
80- paging query, not only writing
LeetCode#20.有效的括号
【206. 反转链表】
杰理之MUSIC 模式获取播放文件的目录【篇】
PHP image making
2022 question bank and simulated examination for work license of main principals of hazardous chemical business units
Objective-C byte size occupied by different data types
解决phpstudy中mysql无法启动,与本地安装的mysql冲突
[513. find the value in the lower left corner of the tree]
Jericho uses DP and DM for IO key detection [chapter]
【链表中倒数第k个结点】
【142. 环形链表 II】
[book delivery at the end of the article] AI has spread all over the Internet to color old photos. Here is a detailed tutorial!
NFT,只可远观不可亵玩焉