From the documentation, I don’t understand how the
fastcgi_cache_revalidate
(or scgi_cache_revalidate or proxy_cache_revalidate or
uwsgi_cache_revalidate) works.
Please, can someone explain what nginx does when cache is enabled and
the
revalidate directive is set to “on”?
From the documentation, I don’t understand how the fastcgi_cache_revalidate
(or scgi_cache_revalidate or proxy_cache_revalidate or
uwsgi_cache_revalidate) works.
Please, can someone explain what nginx does when cache is enabled and the
revalidate directive is set to “on”?
Normally, when a cache entry is expired in nginx cache, nginx fetches a
replacement from upstream.
If cache revalidation is enabled, nginx asks the upstream if the current
(expired) entry is still
valid using “If-Modified-Since” and “If-None-Match” HTTP headers. The
upstream can reply with
“304 Not Modified” to confirm the validity. In this case the entry
remains in cache until it
expires again.
Thanks for the explanation.
At which moment this revalidation is executed? When there’s a new client
request or is it done automatically when a cache entry is about to
expire?
The nginx’s cache manager is deleting expiring cache file, so I’m not
sure
to understand how it all works.
Thanks for the explanation.
At which moment this revalidation is executed? When there’s a new client
request or is it done automatically when a cache entry is about to expire?
When there’s a client request.
Nginx does not do any background cache updates/revalidations/etc.
The nginx’s cache manager is deleting expiring cache file, so I’m not sure
to understand how it all works.
Nginx cache manager has nothing to do with cache entry expiration.
In fact, it does 2 things:
deletes files which were not accessed for the “inactive” time