• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase
您的位置:首页 > 数据库 >Redis > Redis的LRU机制介绍

Redis的LRU机制介绍

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了redis lru,lru机制,lru,lru算法,lru页面置换算法等相关知识,希望本文的分享对您有所帮助

在Redis中,如果设置的maxmemory,那就要配置key的回收机制参数maxmemory-policy,默认volatile-lru,参阅Redis作者的原博客:antirez weblog >> Redis as an LRU cache

原文中写得很清楚:
Another way to use Redis as a cache is the maxmemory directive, a feature that allows specifying a maximum amount of memory to use. When new data is added to the server, and the memory limit was already reached, the server will remove some old data deleting a volatile key, that is, a key with an EXPIRE (a timeout) set, even if the key is still far from expiring automatically.
</div>
在Redis服务器占用内存达到maxmemory的情况下,当再想增加内存占用时,会按maxmemory-policy机制将老的数据删除。这里简单说一下volatile-lru,Redis会按LRU算法删除设置了过期时间但还没有过期的key,而对于没有设置过期时间的key,Redis是永远保留的。当然,如果你不想删除没有过期的key,那可以使用noeviction机制
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached? You can select among five behavior:
#
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys-random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
</div>

</div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • Redis的LRU机制介绍

相关文章

  • 2017-05-11Redis配置文件详解
  • 2017-05-11Redis的Python客户端redis-py安装使用说明文档
  • 2017-05-11Redis中五种数据类型简单操作
  • 2017-05-11CentOS系统中Redis数据库的安装配置指南
  • 2017-11-28Redis的rdb 和aof 持久化的区别
  • 2017-05-11Redis发布订阅和实现.NET客户端详解
  • 2017-05-11Redis教程(一):Redis简介
  • 2017-05-11超强、超详细Redis数据库入门教程
  • 2017-05-11Redis教程(四):Hashes数据类型
  • 2017-05-11Redis有序集合类型的常用命令小结

文章分类

  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase

最近更新的内容

    • 将MongoDB作为Redis式的内存数据库的使用方法
    • 浅谈redis在项目中的应用
    • Redis和Memcached的区别详解
    • 分割超大Redis数据库例子
    • Redis4基于CentOS6集群搭建
    • Redis实现信息已读未读状态提示
    • CentOS 7下安装 redis 3.0.6并配置集群的过程详解
    • 在Redis数据库中实现分布式速率限制的方法
    • 超强、超详细Redis数据库入门教程
    • Redis整合Spring结合使用缓存实例

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有