Adding ability to specify multiple proxy_cache_path entries with unique

proxy_cache_keys_zone values
This commit is contained in:
Jacob McCoy Wade 2015-06-02 10:48:57 -07:00
parent 796bf63893
commit 876713f895
2 changed files with 10 additions and 3 deletions

View file

@ -69,6 +69,7 @@ class nginx::config(
$proxy_cache_keys_zone = 'd2:100m',
$proxy_cache_levels = '1',
$proxy_cache_max_size = '500m',
$proxy_cache_path_hash = 'string',
$proxy_cache_path = false,
$proxy_connect_timeout = '90',
$proxy_headers_hash_bucket_size = '64',
@ -113,7 +114,10 @@ class nginx::config(
}
validate_bool($confd_purge)
validate_bool($vhost_purge)
if ($proxy_cache_path != false) {
if ($proxy_cache_path_hash != 'string') {
validate_hash($proxy_cache_path)
}
elsif ($proxy_cache_path != false) {
validate_string($proxy_cache_path)
}
validate_re($proxy_cache_levels, '^[12](:[12])*$')

View file

@ -64,9 +64,12 @@ http {
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<% end -%>
<% if @proxy_cache_path -%>
<% if @proxy_cache_path_hash != 'string' -%>
<% @proxy_cache_path.sort_by{|k,v| k}.each do |key,value| -%>
proxy_cache_path <%= key %> keys_zone=<%= value %> levels=<%= @proxy_cache_levels %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>;
<% end -%>
<% elsif @proxy_cache_path -%>
proxy_cache_path <%= @proxy_cache_path %> levels=<%= @proxy_cache_levels %> keys_zone=<%= @proxy_cache_keys_zone %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>;
<% end -%>
<% if @fastcgi_cache_path -%>
fastcgi_cache_path <%= @fastcgi_cache_path %> levels=<%= @fastcgi_cache_levels %> keys_zone=<%= @fastcgi_cache_keys_zone %> max_size=<%= @fastcgi_cache_max_size %> inactive=<%= @fastcgi_cache_inactive %>;