当前位置:网站首页>为什么要使用Redis
为什么要使用Redis
2022-07-06 09:20:00 【快醒醒鸭今天你编程了吗?】
主要有以下两方面
1、从高并发上来说:
直接操作缓存能够承受的请求是,远远大于直接访问数据库的,所以我们可以考虑把数据库中的部分数据转移到缓存中去,这样用户的一部分请求会直接到缓存这里而不用经过数据库
2、从高性能上来说:
用户第一次访问数据库中的某些数据,因为是从硬盈上读取的所以这个过程会比较慢,将该用户访问的数据存在缓存中,下一次再访问这些数据的时候就可以直接从缓存中获取了,操作缓存就是直接操作内存,所以速度相当快
为什么要使用Redis而不是其他的,例如Java自带的map或者guava?
缓存分为本地缓存和分布式缓存,像map和guava就是本地缓存,本地缓存最主要的特点是轻量以及快速,生命周期随着jivm的销毁而结束,在多实例的情况下,每个实例都需要各自保存一份缓存,缓存不具有一致性
使用redis或memcached之类的称为分布式缓存,在多实例的情况下,各实例共用份缓存为握 缓存具有一致性。
边栏推荐
- The latest tank battle 2022 - Notes on the whole development -2
- View UI plus releases version 1.1.0, supports SSR, supports nuxt, and adds TS declaration files
- ROS machine voice
- Summary of multiple choice questions in the 2022 database of tyut Taiyuan University of Technology
- View UI Plus 發布 1.3.1 版本,增强 TypeScript 使用體驗
- First acquaintance with C language (Part 2)
- 凡人修仙学指针-2
- 12 excel charts and arrays
- (超详细onenet TCP协议接入)arduino+esp8266-01s接入物联网平台,上传实时采集数据/TCP透传(以及lua脚本如何获取和编写)
- The latest tank battle 2022 full development notes-1
猜你喜欢

Common method signatures and meanings of Iterable, collection and list

Tyut Taiyuan University of technology 2022 "Mao Gai" must be recited

5.函数递归练习

2. Preliminary exercises of C language (2)

7. Relationship between array, pointer and array

TYUT太原理工大学2022数据库大题之分解关系模式

TYUT太原理工大学2022数据库大题之概念模型设计

The latest tank battle 2022 - Notes on the whole development -2

IPv6 experiment

TYUT太原理工大学2022数据库之关系代数小题
随机推荐
西安电子科技大学22学年上学期《基础实验》试题及答案
arduino+水位传感器+led显示+蜂鸣器报警
3.输入和输出函数(printf、scanf、getchar和putchar)
西安电子科技大学22学年上学期《射频电路基础》试题及答案
【话题终结者】
分支语句和循环语句
Counter attack of flour dregs: redis series 52 questions, 30000 words + 80 pictures in detail.
Smart classroom solution and mobile teaching concept description
First acquaintance with C language (Part 2)
5. Download and use of MSDN
2-year experience summary, tell you how to do a good job in project management
A brief introduction to the database of tyut Taiyuan University of technology in previous years
2.C语言矩阵乘法
167. Sum of two numbers II - input ordered array - Double pointers
TYUT太原理工大学2022软工导论考试题型大纲
View UI Plus 發布 1.3.1 版本,增强 TypeScript 使用體驗
Alibaba cloud microservices (I) service registry Nacos, rest template and feign client
【快趁你舍友打游戏,来看道题吧】
System design learning (III) design Amazon's sales rank by category feature
JS interview questions (I)