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 版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    页面上输入任意数字,点击按钮后计算阶乘。
    利用递归求两个数字的最大公约数。
    17css动画
    10Vue组件参数校验和非Props特性
    git rebase --continue出现“If there is nothing left to stage,chances are that something else already introduced the same changes; you might want to skip this patch.”
    9Vue父子组件的传递方式
    8Vue组件使用细节
    Block-scoped declarations问题解决
    7Vue中的set方法
    6Vue条件渲染
  • 原文地址:https://www.cnblogs.com/maowenqiang/p/10407198.html
Copyright © 2011-2022 走看看