首页 > 数据库 >Redis - Evictions

Redis - Evictions

时间:2022-08-19 11:22:09浏览次数:68  
标签:set keys Evictions Redis least used volatile expire

This behavior is well known in the developer community, since it is the default behavior for the popular memcached system.

Maxmemory configuration directive

The maxmemory configuration directive configures Redis to use a specified amount of memory for the data set. You can set the configuration directive using the redis.conf file, or later using the CONFIG SET command at runtime.

Eviction policies

• noeviction: New values aren’t saved when memory limit is reached.
• allkeys-lru: Keeps most recently used keys; removes least recently used (LRU) keys
• allkeys-lfu: Keeps frequently used keys; removes least frequently used (LFU) keys
• volatile-lru: Removes least recently used keys with the expire field set to true.
• volatile-lfu: Removes least frequently used keys with the expire field set to true.
• allkeys-random: Randomly removes keys to make space for the new data added.
• volatile-random: Randomly removes keys with expire field set to true.
• volatile-ttl: Removes keys with expire field set to true and the shortest remaining time-to-live (TTL) value.

How the eviction process works

• A client runs a new command, resulting in more data added.
• Redis checks the memory usage, and if it is greater than the maxmemory limit , it evicts keys according to the policy.
• A new command is executed, and so forth.

标签:set,keys,Evictions,Redis,least,used,volatile,expire
From: https://www.cnblogs.com/feiqiangsheng/p/16601408.html

相关文章

  • 关于SpringBoot整合redis使用Lettuce客户端超时问题
    问题起因使用到Lettuce连接redis,一段时间后不操作,再去操作redis,会报连接超时错误,在其重连后又可使用。原因是:Lettuce自适应拓扑刷新(Adaptiveupdates)与定时拓扑刷新(Peri......
  • Docker安装Redis
    1.下载Redis镜像sudodockerpullredis 2.启动Redissudomkdir-p/mydata/redis/confsudotouch/mydata/redis/conf/redis.confsudodockerrun-p63......
  • Redis 内存占满
    1.案例redis内存占用满了错误提示:OOMcommandnotallowedwhenusedmemory>‘maxmemory’2.排查步骤确定哪台redis服务器使用set命令随便设置值,查看是否成......
  • docker compose搭建redis7.0.4高可用一主二从三哨兵集群并整合SpringBoot【图文完整版
    一、前言redis在我们企业级开发中是很常见的,但是单个redis不能保证我们的稳定使用,所以我们要建立一个集群。redis有两种高可用的方案:HighavailabilitywithRedisSen......
  • 深入理解Redis 数据结构—字典
    字典,又称为符号表、关联数组或映射,是一种用于保存键值对的抽象数据结构。在字典中,一个键可以和一个值进行关联,这些关联的键和值称为键值对。键值对中键是唯一的,我们可以......
  • Redis学习(2)set和zset
    set集合底层就是一个hash表,只不过保存的值是null。添加删除saddkeyelementelement...用element等创建一个setsmemberskey显示key中成员sismemberskeyelemen......
  • 【Azure Redis 缓存】Redisson 连接 Azure Redis出现间歇性 java.net.UnknownHostExce
    问题描述在Java项目中,使用Redisson作为连接Redis的客户端,间歇性的出现了DNSMonitorthrowable错误。DNSMonitorthrowable="java.net.UnknownHostException:failedto......
  • redis-golang strings 操作
    本文来自于  github.com/go-redis/redis/v9的自带的测试代码commands_test1、Append(ctxcontext.Context,key,valuestring)//如果不存在key,就将keyval......
  • Redis - Persistence
    • RDB(RedisDatabase):TheRDBpersistenceperformspoint-in-timesnapshotsofyourdatasetatspecifiedintervals.• AOF(AppendOnlyFile):TheAOFpersis......
  • Redis不同版本集群搭建
    redis集群搭建官方网址:https://redis.io/download/下载下来的为.tar.gz扩展名的源码包。一、redis5.0版本之前集群搭建需要redis-trib.rb工具来完成集群的创建,redis-tr......