Redis memory replacement strategy

Preface:

Redis as a cache, we need maximum memory configured maxmemory, recommended to set the maximum physical memory in general, but in the actual process if more than the maximum memory settings, Redis offers a variety of replacement policies.

Resis profile maxmemory-policy:

Redis default configuration file maxmemory-policy is noeviction, is not directly delete key returns an error; in addition noeviction there are several options:

volatile-lru: on key with the life cycle is the LRU algorithm replacement;
volatile-Random: on key with the life cycle of random permutation;
volatile-TTL: on key with the life cycle of random sampling, displacing sampling lifetime Shortest the;
AllKeys-LRU: LRU algorithm for replacement of the entire db;
AllKeys-random: db random permutation on the whole.

 

Guess you like

Origin www.cnblogs.com/afeng-chen/p/11653358.html