Welcome! Log In Create A New Profile

Advanced

Inconsistency about cache's valid_sec

Peng Fang
July 19, 2017 01:26AM
Hello, Maxim and other developers,

In the latest official release, ngx_http_file_cache_set_header will be
called in ngx_http_upstream_send_response to realy set a cached file's
valid_sec.
before calling ngx_http_file_cache_set_header, there will be a chance for
user defined modules to change the valid_sec in their header filter
hooks,no matter what the value is set by
Cache-Control/Expires/X-Accel-Expires previously.

And that's reasonable.

When a cached file is expired, that logic will work fine too.

Inconsistency happens, however, when proxy_cache_revalidate
<http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_revalidate>
is enabled. when we enable proxy_cache_revalidate
<http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_revalidate>,
ngx_http_file_cache_update_header will be called in
ngx_http_upstream_test_next. And in ngx_http_upstream_test_next, there is
no chance for user defined modules to change the valid_sec finally in their
header filter hooks. Because before calling ngx_http_upstream_cache_send in
ngx_http_upstream_test_next, valid_sec will be cached firstly, and set to a
cached file after calling ngx_http_upstream_cache_send and
ngx_http_file_cache_update_header.

If we get valid_sec after ngx_http_upstream_cache_send in
ngx_http_upstream_test_next, user defined module's modification of
valid_sec will take effect.And the consistency will be kept.

I don't konw if i missed something, so what do you think about this
situation?
Thanks.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Inconsistency about cache's valid_sec

Peng Fang 574 July 19, 2017 01:26AM

Re: Inconsistency about cache's valid_sec

Maxim Dounin 231 July 19, 2017 08:36AM

Re: Inconsistency about cache's valid_sec

Peng Fang 245 July 19, 2017 10:24PM

Re: Inconsistency about cache's valid_sec

Maxim Dounin 201 July 20, 2017 09:12AM

Re: Inconsistency about cache's valid_sec

Peng Fang 235 July 20, 2017 10:26AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready