Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for proxy_cache_path loader directives #984

Merged

Conversation

carroarmato0
Copy link
Contributor

Add support for loader_files, loader_sleep and loader_threshold for proxy_cache_path.

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path

Syntax:	proxy_cache_path path [levels=levels] [use_temp_path=on|off] keys_zone=name:size [inactive=time] [max_size=size] [manager_files=number] [manager_sleep=time] [manager_threshold=time] [loader_files=number] [loader_sleep=time] [loader_threshold=time] [purger=on|off] [purger_files=number] [purger_sleep=time] [purger_threshold=time];
Default:	—
Context:	http

Signed-off-by: Christophe Vanlancker christophe.vanlancker@inuits.eu

@wyardley
Copy link
Collaborator

Can you add tests to this?

@carroarmato0 carroarmato0 force-pushed the carroarmato0/proxy_cache_loader branch 3 times, most recently from 5bef99b to d412d20 Compare December 19, 2016 22:31
@carroarmato0
Copy link
Contributor Author

@wyardley managed to get the tests I wrote green.

@@ -157,10 +157,10 @@ http {
<% end -%>
<% if @proxy_cache_path.is_a?(Hash) -%>
<% @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 %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end -%>;
proxy_cache_path <%= key %> keys_zone=<%= value %> levels=<%= @proxy_cache_levels %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end -%><% if @proxy_cache_loader_files %> loader_files=<%= @proxy_cache_loader_files %><% end -%><% if @proxy_cache_loader_sleep %> loader_sleep=<%= @proxy_cache_loader_sleep %><% end -%><% if @proxy_cache_loader_threshold %> loader_threshold=<%= @proxy_cache_loader_threshold %><% end -%>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use -%>; and split this in multiple lines for readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nginx unfortunately doesn't allow you to work with multi-lines (except for a few directives, but the proxy_cache_path is not one of them).

So I'm afraid I can't change that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is why I suggested -%>;

$ cat a.erb 
a <% if true %>b <% end -%>
c
$ erb -T - < a.erb 
a b c

<% 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 %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end %>;
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 %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end %><% if @proxy_cache_loader_files %> loader_files=<%= @proxy_cache_loader_files %><% end -%><% if @proxy_cache_loader_sleep %> loader_sleep=<%= @proxy_cache_loader_sleep %><% end -%><% if @proxy_cache_loader_threshold %> loader_threshold=<%= @proxy_cache_loader_threshold %><% end -%>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment

Signed-off-by: Christophe Vanlancker <christophe.vanlancker@inuits.eu>
@roidelapluie roidelapluie merged commit c32f4f1 into voxpupuli:master Dec 20, 2016
@carroarmato0 carroarmato0 deleted the carroarmato0/proxy_cache_loader branch December 20, 2016 15:05
cegeka-jenkins pushed a commit to cegeka/puppet-nginx that referenced this pull request Sep 13, 2019
…_cache_loader

Add support for proxy_cache_path loader directives
Rubueno pushed a commit to Rubueno/puppet-nginx that referenced this pull request Oct 19, 2020
…_cache_loader

Add support for proxy_cache_path loader directives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants