Home  >  Article  >  Database  >  How to set the maximum memory occupied by redis

How to set the maximum memory occupied by redis

王林
王林forward
2020-12-17 09:18:433078browse

How to set the maximum memory occupied by redis

Setting method:

(Learning video sharing: redis video tutorial)

Redis settings occupy a physical machine Maximum memory

#占用最大20G
maxmemory 20480mb

Redis setting memory cannot be loaded, limited deletion is about to expire.

When the currently used memory exceeds the maxmemory limit, the active cleanup policy is triggered

  • volatile-lru: Only perform LRU on keys with an expiration time set (default value)

  • allkeys-lru: Delete the lru algorithm's

  • keyvolatile-random: Random deletion is about to expire

  • keyallkeys-random: Randomly delete

  • ##volatile-ttl: Delete the soon-to-expire

  • noeviction: Never expire, return error when mem_used memory The setting of maxmemory has been exceeded. For all read and write requests

  • #超过后删除即将过期的
    maxmemory-policy  volatile-ttl
Related recommendations:

redis database tutorial

The above is the detailed content of How to set the maximum memory occupied by redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete