question about proxy_cache_valid

s0cke at leech.it s0cke at leech.it
Thu Sep 10 20:39:31 MSD 2009


Hello,

Maxim Dounin wrote:
> 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. 

So when I use "proxy_cache_use_stale off;" which is default, nginx will 
request the file again from the backend, if the time in 
"proxy_cache_valid" is over?

> 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.

I am not quite sure whether I understand it correctly or not. I simply 
want nginx to cache responses with 200 status for 2 hours. After this 
time the response gets deleted from cache, so when new clients want the 
file, nginx requests it again from backend.
In other words: The requests should be stored in cache for 2 hours after 
the last request from backend, not for 2 hours after the last request 
from a client.
Could you give me a hint on how to achieve this behavior?

>> 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 
> 0.8.14:
> 
>     *) Bugfix: an expired cached response might stick in the "UPDATING" 
>        state.
> 
> If you see this in 0.8.14 - please provide more details.

I am using the stable version (0.7.61). Do I have to update to 0.8.14 in 
order to get this working? I'm not sure whether it's my config or a bug.
Hm.. and I can't figure out the meaning of the "updating" state. All the 
other states are clear to me.

Thanks for your help!





More information about the nginx mailing list