zoukankan      html  css  js  c++  java
  • redis 数据淘汰策略与配置

    redis 数据淘汰策略

    volatile-lru:从已设置过期的数据集中挑选最近最少使用的淘汰
    volatile-ttl:从已设置过期的数据集中挑选将要过期的数据淘汰
    volatile-random:从已设置过期的数据集中任意挑选数据淘汰
    allkeys-lru:从数据集中挑选最近最少使用的数据淘汰
    allkeys-random:从数据集中任意挑选数据淘汰
    noenviction:禁止淘汰数据
    redis淘汰数据时还会同步到aof中、从机


    配置文件 

    # maxmemory <bytes>
    # volatile-lru -> remove the key with an expire set using an LRU algorithm
    # allkeys-lru -> remove any key according 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
    # The default is:
    # maxmemory-policy noeviction
    我们可以设置maxmemory <bytes>,当数据达到限定大小后,会选择配置的策略淘汰数据

    可设置内存最大使用量,超出时淘汰, 淘汰策略。
    策略
    描述
    volatile-lru
    从已设置过期时间的数据集中挑选最近最少使用的数据淘汰
    volatile-ttl
    从已设置过期时间的数据集中挑选将要过期的数据淘汰
    volatile-random
    从已设置过期时间的数据集中任意选择数据淘汰
    allkeys-lru
    从所有数据集中挑选最近最少使用的数据淘汰;最常用的热点数据缓存策略
    allkeys-random
    从所有数据集中任意选择数据进行淘汰
    no-envicition
    禁止驱逐数据
    缓存热点数据,启用 allkeys-lru 淘汰策略,--------------------- 作者:zzpueye 来源:CSDN 原文:https://blog.csdn.net/zzpueye/article/details/81451916 版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    获取Mac地址
    GbkToUtf8 Utf8ToGbk PackHttp
    first Automation
    win32 Dll 中添加afx.h 出现如下错误 error LNK2005: _DllMain@12 already defined
    OpenSUSE 开启SSH 和网络设置
    systemctl命令用法详解
    浅谈Python的列表和链表
    用Python实现最大堆
    写一个解二阶魔方的程序
    暴力破解SixPack问题
  • 原文地址:https://www.cnblogs.com/maowenqiang/p/10407198.html
Copyright © 2011-2022 走看看