婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Redis的LRU機制介紹

Redis的LRU機制介紹

熱門標簽:天音通信電話機器人 高德地圖標注商家在哪 機器人電話機創意繪畫 江西南昌百應電話機器人 隨州營銷電話機器人怎么樣 400電話申請怎么看 400電話從哪里申請濱州 杭州400電話如何申請的 hbuilder地圖標注

在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.

在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

您可能感興趣的文章:
  • 如何高效使用Redis作為LRU緩存
  • Redis中LRU淘汰策略的深入分析
  • Redis緩存常用4種策略原理詳解
  • 手動實現Redis的LRU緩存機制示例詳解

標簽:昆明 鶴崗 葫蘆島 石嘴山 保定 沈陽 招商 常德

巨人網絡通訊聲明:本文標題《Redis的LRU機制介紹》,本文關鍵詞  Redis,的,LRU,機制,介紹,Redis,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Redis的LRU機制介紹》相關的同類信息!
  • 本頁收集關于Redis的LRU機制介紹的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 道真| 图片| 布拖县| 三都| 焦作市| 余庆县| 贵定县| 兴文县| 紫阳县| 宜章县| 灵寿县| 大悟县| 泸定县| 东至县| 广南县| 临朐县| 衡东县| 交城县| 微山县| 怀集县| 股票| 门头沟区| 怀化市| 密云县| 青浦区| 黄浦区| 乐清市| 新乡市| 津市市| 平陆县| 丰顺县| 法库县| 那坡县| 彭山县| 元氏县| 车致| 怀来县| 富蕴县| 巍山| 灵璧县| 灵石县|