Updating r->cache in ngx_http_upstream_process_cache_control()

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Fri Jul 26 20:14:39 UTC 2024


Hello,

I would like to understand the rationale for updating
r->cache->valid_sec (and other fields in r->cache) in
ngx_http_upstream_process_cache_control().

It appears that ngx_http_upstream_process_cache_control() can be
called (via ngx_http_proxy_process_header()) in two scenarios: when
sending a cached response to the client, and when receiving a response
from the upstream server.

Obviously, calling ngx_http_upstream_process_cache_control() when
receiving a response from the upstream server is completely expected.
However, calling ngx_http_upstream_process_cache_control(), and more
specifically, modifying r->cache fields while sending a cached
(NGX_HTTP_CACHE_HIT and possibly others) response is not completely
clear to me.

Thanks!
Max


More information about the nginx-devel mailing list