Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stale-while-revalidate cache replacement from Varnish

We are currently moving our servers to a new one, with PLESK 12.5 which doesn't support Varnish cache for our PHP applications.

We use Varnish, mostly for the 'stale-while-revalidate' capability, so that we can send whole pages or parts (using ESI) without any waiting time for any customer while cache is refreshing.

Is there any alternative to Varnish for a similar kind of cache ? Either another "program" that could run on PLESK, or any PHP/server cache ?

PLESK comes with NGINX, but it does not seem to provide 'stale-while-revalidate' capabilities ; I also know Squid isn't supported on PLESK.

like image 478
elwood Avatar asked Feb 06 '23 21:02

elwood


1 Answers

Actually nginx provides stale-while-revalidate by proxy_cache_use_stale and Nginx supports Cache-Control extensions since 1.11.10:

location / {
    ...
    proxy_cache_use_stale updating error timeout http_500 http_502 http_503 http_504;
    proxy_cache_background_update on;
}

Yes, it does not support Cache-Control extension, with so if your application does not use stale-while-revalidate in Cache-Control header nginx will be enough.

like image 91
Oleg Neumyvakin Avatar answered Feb 16 '23 17:02

Oleg Neumyvakin