Francis Daly
May 17, 2017 11:54AM
On Wed, May 17, 2017 at 03:29:03AM -0400, mkuehn wrote:

Hi there,

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

I'm pretty sure that nginx's internationalisation/localisation efforts
don't allow it to recognise that "test" and "spieldaten" should be
considered equivalent :-)

That aside: the auto-refresh works for me.

Using your proxy_cache settings in a test nginx.conf:

==
http {
server {
listen 8880;
return 200 "Now it is $time_local\n";
access_log logs/upstream.log;
}

proxy_cache_path /tmp/testcache levels=1 keys_zone=test:10m max_size=10m inactive=5d use_temp_path=off;

server {
listen 8080;
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;

access_log logs/main.log;
location / {
proxy_pass http://127.0.0.1:8880;
}
}
}
==

I can do

$ while :; do date; curl http://127.0.0.1:8080/; sleep 7; done

and the first request after the 1-minute expiry gives me the old content;
and the next request gives me the new content that was fetched 7 seconds
previously.

(And I can compare the different log files, to see how much my caching
saved the upstream port 8880 server from processing.)

Which seems to be exactly what you want.

Does that test work for you? If it does not, there is a problem to be
resolved. If it does, then you can start to compare your own system with
what is above, and spot the difference.

> Maybe you have an idea, why proxy_cache_background_update not working?

As above, it works for me. So - what is different in your system?

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Auto refresh for expired content?

mkuehn May 16, 2017 12:47PM

Re: Auto refresh for expired content?

Francis Daly May 16, 2017 01:20PM

Re: Auto refresh for expired content?

mkuehn May 17, 2017 03:29AM

Re: Auto refresh for expired content?

Roman Arutyunyan May 17, 2017 07:14AM

Re: Auto refresh for expired content?

mkuehn May 17, 2017 09:07AM

Re: Auto refresh for expired content?

Roman Arutyunyan May 18, 2017 07:44AM

Re: Auto refresh for expired content?

mkuehn May 18, 2017 10:02AM

Re: Auto refresh for expired content?

mkuehn May 29, 2017 10:21AM

Re: Auto refresh for expired content?

Francis Daly May 17, 2017 11:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 248
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready