From 2095f20b839293de981e73ec316e075ab63d8212 Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Sun, 12 Apr 2015 20:13:49 +0200 Subject: [PATCH] Add maxmemory-policy configurable This patch makes the redis maxmemory-policy configurable, and sets default value to allkeys-lru instead of volatile-lru. The setting allkeys-lru helps to remove keys without an exact expire setting of a keypair. Change-Id: I5edaa6a5fbdc99631838478460b36795539292cf --- manifests/init.pp | 1 + templates/redis.2.2.conf.erb | 1 + templates/redis.2.4.conf.erb | 1 + templates/redis.2.6.conf.erb | 1 + 4 files changed, 4 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 74b7aa2..d291dfe 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,6 +21,7 @@ class redis( $redis_bind = '127.0.0.1', $redis_password = '', $redis_max_memory = '1gb', + $redis_max_memory_policy = 'allkeys-lru', $version = '2.2.12', ) { diff --git a/templates/redis.2.2.conf.erb b/templates/redis.2.2.conf.erb index 9a668df..32e40a2 100644 --- a/templates/redis.2.2.conf.erb +++ b/templates/redis.2.2.conf.erb @@ -218,6 +218,7 @@ maxmemory <%= redis_max_memory %> # The default is: # # maxmemory-policy volatile-lru +maxmemory-policy <%= @redis_max_memory_policy %> # LRU and minimal TTL algorithms are not precise algorithms but approximated # algorithms (in order to save memory), so you can select as well the sample diff --git a/templates/redis.2.4.conf.erb b/templates/redis.2.4.conf.erb index 11c9190..ec87645 100644 --- a/templates/redis.2.4.conf.erb +++ b/templates/redis.2.4.conf.erb @@ -254,6 +254,7 @@ maxmemory <%= redis_max_memory %> # The default is: # # maxmemory-policy volatile-lru +maxmemory-policy <%= @redis_max_memory_policy %> # LRU and minimal TTL algorithms are not precise algorithms but approximated # algorithms (in order to save memory), so you can select as well the sample diff --git a/templates/redis.2.6.conf.erb b/templates/redis.2.6.conf.erb index 2719e94..3c00c3d 100644 --- a/templates/redis.2.6.conf.erb +++ b/templates/redis.2.6.conf.erb @@ -338,6 +338,7 @@ maxmemory <%= redis_max_memory %> # The default is: # # maxmemory-policy volatile-lru +maxmemory-policy <%= @redis_max_memory_policy %> # LRU and minimal TTL algorithms are not precise algorithms but approximated # algorithms (in order to save memory), so you can select as well the sample