proxy_cache_use_stale updating

Maxim Dounin mdounin at mdounin.ru
Wed Sep 9 17:30:06 UTC 2015


Hello!

On Wed, Sep 09, 2015 at 12:38:18PM +0200, Nguyen Nhat Khang wrote:

> I've one storage server using nginx, one cache file server using nginx.
> The following are my configuration files:

[...]

>         proxy_cache_key     $request_uri;
>         proxy_cache_valid    200 30d;
>         proxy_temp_path      /nginx-cache/cache-level1/temp;
>         proxy_cache_use_stale updating;

[...]

> I request multiple times and received multiple files in the
> /nginx-cache/cache-level1/temp folder 000000xx format. I think I have
> the wrong configuration in my configuration file because it works unlike
> what I've read. I never saw the $ upstream_cache_status UPDATING in
> cache.log.

The "proxy_cache_use_stale updating" only works when _updating_ 
cache items, i.e., when a cache items becomes stale.  As your 
proxy_cache_valid is set to 30 days, you should be able to see it 
working only after 30 days (if at all, as resources may be removed 
from cache due to inactivity).

If you want to reduce load when initially loading resources, 
consider proxy_cache_lock, see http://nginx.org/r/proxy_cache_lock.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list