当前位置:网站首页>Redis最大内存淘汰策略
Redis最大内存淘汰策略
2022-06-21 12:02:00 【仅此而已_】
Redis最大内存淘汰策略
Redis内存超出物理内存的限制的时候,会产生内存对换(swap)现象,与高速的Redis思想相违背。
因此生产环境中,不允许Redis有内存交换行为,Redis提供了配置参数maxmemory限制内存。
实际内存超出maxmemory的时候,Redis提供了几种可选淘汰策略。
noeviction
不会继续服务写请求,可以继续读请求和del请求。保证已有的数据不丢失,但是会让线上一些业务无法进行。默认策略。
volatile-lru
淘汰含有过期时间的,最久未使用的key。
没有设置过期时间的key不会被淘汰,保证持久化。
volatile-ttl
淘汰含有过期时间的,ttl最小的key
volatile-random
随机淘汰含有过期时间的key
allkeys-lru
淘汰最久未使用的key,范围是全部key,带有不带有过期时间一视同仁。
allkeys-random
随机淘汰key,范围是全部key,带有不带有过期时间一视同仁。
总结
volatile-xxx只会在含有过期时间的key中选择淘汰;
allkeys-xxx会在所有的key中选择淘汰。
如果仅仅是作为缓存,可以使用allkeys淘汰策略;
如果需要持久化功能,可以使用volatile淘汰策略。
边栏推荐
- 方法的继承和重写
- Some functions used in tensorflow
- 中信建投券商是跟启牛学堂存在什么关系?开券商账户安全吗
- The k-th small__
- 6-zabbix monitors and automatically discovers the memory and CPU usage of third-party Middleware
- Apache ShardingSphere 5.1.2 发布|全新驱动 API + 云原生部署,打造高性能数据网关
- [Harbin Institute of technology] information sharing for the first and second examinations of postgraduate entrance examination
- [yolov5s target detection] opencv loads onnx model for reasoning on GPU
- 第八章 Web项目测试
- i.MX - RT1052输入输出(GPIO)
猜你喜欢

Chapter VIII web project testing

蜜雪冰城(已黑化)

Introduction to common source oscilloscope software and RIGOL oscilloscope upper computer software ns-scope

WPF 使用 MAUI 的自绘制逻辑

STM32开发之 VS Code + GDB下载调试

i.MX - RT1052 脉宽调制(PWM)

1108. IP 地址无效化

Jenkins configures scheduled tasks through build periodically

Ansible 配置首次ssh免认证的操作说明

uniapp中常用到的方法(部分) - 时间戳问题及富文本解析图片问题
随机推荐
MySQL 5.6.49 enterprise version setting password complexity policy
PCB电路板设计都有哪些注意事项?
Nanjing University static program analyses -- intermediate representation learning notes
knowing和understanding的区别
Hands on data analysis data reconstruction
The difference between knowing and understanding
华为云发布桌面IDE-CodeArts
使用Huggingface在矩池云快速加载预训练模型和数据集
Some functions used in tensorflow
TypeScript 变量声明 —— 类型断言(Type Assertion)
Is pension insurance a financial product? What is the expected return?
[yolov5s target detection] opencv loads onnx model for reasoning on GPU
Ansible 配置首次ssh免认证的操作说明
I would like to ask you guys, the flick CDC will add a table level exclusive lock before extracting the full amount of Oracle data
『忘了再学』Shell流程控制 — 36、for循环介绍
自动弹出 微信授权登录窗口
typora免费版,无需破解,安装直接使用
STL基本容器测试
Golang implements redis (9): use geohash to search people nearby
养老年金险是理财产品吗?预期收益是多少?