Auto refresh for expired content?
mkuehn
nginx-forum at forum.nginx.org
Wed May 17 07:29:03 UTC 2017
Hi Francis,
thanks a lot for your reply!
I tried to use proxy_cache_background_update with the following config
part.
proxy_cache_path /var/cache/nginx/spieldaten levels=1:2
keys_zone=spieldaten:100m max_size=150m inactive=5d use_temp_path=off;
... ... ...
proxy_cache test;
proxy_cache_valid 200 302 1m;
proxy_cache_valid 404 1m;
proxy_cache_valid any 2m;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_cache_use_stale error timeout updating http_500 http_502
http_503 http_504;
proxy_cache_lock on;
proxy_cache_background_update on;
So my hope was with an inactive setup of 5d, even the requests which are not
often called, will be keep i the cache and proxy_cache_background_update
will do the magic - if a user request content, it will be fetch the "old"
one from the cache and nginx will fetch a fresh copy in the background.
But unfortunately the user gets always the old one from the cache, if
proxy_cache_background_update is on - so something must be wrong with my
config?!?
I even thought about a cron job, but the problem is, i have thousands of
different requests - so my hope was, that nginx can do the magic, wenn a
content in the cache expired, there will be a "trigger" that nginx can fetch
a new one in the background...
Maybe you have an idea, why proxy_cache_background_update not working?
Thanks!
Maik
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274264,274276#msg-274276
More information about the nginx
mailing list