当前位置:网站首页>为什么要使用Redis
为什么要使用Redis
2022-07-06 09:20:00 【快醒醒鸭今天你编程了吗?】
主要有以下两方面
1、从高并发上来说:
直接操作缓存能够承受的请求是,远远大于直接访问数据库的,所以我们可以考虑把数据库中的部分数据转移到缓存中去,这样用户的一部分请求会直接到缓存这里而不用经过数据库
2、从高性能上来说:
用户第一次访问数据库中的某些数据,因为是从硬盈上读取的所以这个过程会比较慢,将该用户访问的数据存在缓存中,下一次再访问这些数据的时候就可以直接从缓存中获取了,操作缓存就是直接操作内存,所以速度相当快
为什么要使用Redis而不是其他的,例如Java自带的map或者guava?
缓存分为本地缓存和分布式缓存,像map和guava就是本地缓存,本地缓存最主要的特点是轻量以及快速,生命周期随着jivm的销毁而结束,在多实例的情况下,每个实例都需要各自保存一份缓存,缓存不具有一致性
使用redis或memcached之类的称为分布式缓存,在多实例的情况下,各实例共用份缓存为握 缓存具有一致性。
边栏推荐
- Comparison between FileInputStream and bufferedinputstream
- Design a key value cache to save the results of the most recent Web server queries
- 1.C语言初阶练习题(1)
- 最新坦克大战2022-全程开发笔记-1
- 20220211-CTF-MISC-006-pure_ Color (use of stegsolve tool) -007 Aesop_ Secret (AES decryption)
- Quickly generate illustrations
- View UI Plus 发布 1.3.0 版本,新增 Space、$ImagePreview 组件
- View UI Plus 发布 1.2.0 版本,新增 Image、Skeleton、Typography组件
- 5.函数递归练习
- View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
猜你喜欢

E-R graph to relational model of the 2022 database of tyut Taiyuan University of Technology

The overseas sales of Xiaomi mobile phones are nearly 140million, which may explain why Xiaomi ov doesn't need Hongmeng

9.指针(上)

12 excel charts and arrays

MySQL Database Constraints

Rich Shenzhen people and renting Shenzhen people

8. C language - bit operator and displacement operator

Mortal immortal cultivation pointer-1

Summary of multiple choice questions in the 2022 database of tyut Taiyuan University of Technology

9. Pointer (upper)
随机推荐
View UI Plus 发布 1.3.0 版本,新增 Space、$ImagePreview 组件
Tyut Taiyuan University of technology 2022 introduction to software engineering
5. Function recursion exercise
6.函数的递归
MySQL 30000 word essence summary + 100 interview questions, hanging the interviewer is more than enough (Collection Series
Abstract classes and interfaces
View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
E-R graph to relational model of the 2022 database of tyut Taiyuan University of Technology
TYUT太原理工大学2022数据库大题之E-R图转关系模式
Alibaba cloud side: underlying details in concurrent scenarios - pseudo sharing
Aurora system model of learning database
Alibaba cloud microservices (I) service registry Nacos, rest template and feign client
9. Pointer (upper)
Tyut outline of 2022 database examination of Taiyuan University of Technology
Service ability of Hongmeng harmonyos learning notes to realize cross end communication
System design learning (III) design Amazon's sales rank by category feature
CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
2. Preliminary exercises of C language (2)
Data manipulation language (DML)
Introduction and use of redis