Proxy_cache: Activity vs. Validity


I am new to nginx (and to caching proxies), and I’d like to make sure I
use the Proxy module correctly. As far as I understand, the following

proxy_cache_path /data/nginx/cache/one levels=1
keys_zone=one:10m inactive=10m max_size:500m;

asks nginx to cache a certain page for 10 minutes. If it is not
requested again within that time span, the page is removed from the
cache. I assume that without the inactive parameter, pages remain in the
cache until either the maximum zone size (10 MB) or the maximum cache
size (500 MB) is reached.

Now I wonder how the proxy_cache_valid contributes to the caching
mechanism. The wiki
( says that
there is no persistent caching without proxy_cache_valid – but what
does that mean exactly? A configuration without proxy_cache_valid works
(pages are cached, and cached pages are sent back to the client), so
what is different with proxy_cache_valid?

Also, how does proxy_cache_valid relate to the inactive parameter above?
If, for example, I set proxy_cache_valid for for any response to 10
minutes, but the inactive parameter to 20 minutes, cached pages will
remain in the cache for 10 minutes after they have become invalid (i.e.
if the page is requested 15 minutes after the initial request, the
existing cache entry is ignored). If this assumption is correct, it
probably makes no sense to set the inactive parameter to a higher value
than proxy_cache_valid.

Best regards,

Posted at Nginx Forum:,135262,135262#msg-135262

Apologies: The working configuration did have proxy_cache_valid buried
in some included file, so my post was pointless.

Posted at Nginx Forum:,135262,135607#msg-135607

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs