オンメモリ KVS の Redis では、使用メモリに上限を設定し、閾値を超えた場合のポリシー(maxmemory-policy)を複数の中から設定できるようになっている。 パラメータとポリシーを整理したのが以下 使用メモリの上限値 redis.conf の次のパラメータで設定する。 maxmemory maxmemory-policy メモリ使用量が閾値を超えている状況でキー追加する場合の振る舞いを定義する。以下の 6 つの maxmemory-policy から選択できる。 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
![Redisのメモリ管理ポリシーについて](https://cdn-ak-scissors.b.st-hatena.com/image/square/671d9bc535387e6ad6e57d2a82d17f12a56d1aed/height=288;version=1;width=512/https%3A%2F%2Fsiguniang.files.wordpress.com%2F2012%2F03%2Fredis_evict_process_middle.png)