question about proxy_cache_valid

Maxim Dounin mdounin at
Thu Sep 10 19:45:56 MSD 2009


On Thu, Sep 10, 2009 at 05:06:26PM +0200, s0cke at wrote:

> Hi,
> what is the difference between the proxy_cache_valid directive and the  
> "inactive" parameter of the proxy_cache_path directive?
> When I set "proxy_cache_valid 10m;" and "inactive=1h", how long will the  
> request be stored?
> And what about the controverse: "proxy_cache_valid 200 1h;" and  
> "inactive=10m"?

Directive proxy_cache_valid specifies how long response will be 
considered valid (and will be returned without any requests to 
backend).  After this time response will be considered "stale" and 
either won't be returned or will be depending on 
proxy_cache_use_stale setting. 

Argument "inactive" of proxy_cache_path specifies how long 
response will be stored in cache after last use.  Note that even 
stale responses will be considered recently used if there are 
requests to them.

> For some reason my cache still contains a file, that has been deleted on  
> my backend 10 hours ago. Both, proxy_cache_valid and inactive= are set  
> to 2h. Maybe the two settings have different meanings and I do not  
> understand yet.

Which version?  From the description it looks like a bug fixed in 

    *) Bugfix: an expired cached response might stick in the "UPDATING" 

If you see this in 0.8.14 - please provide more details.

Maxim Dounin

More information about the nginx mailing list