Cache Invalidation

Dridi Boukelmoune dridi at varni.sh
Tue May 31 15:34:03 CEST 2016


> Right now the TTL is getting set (by backend Cache-Control) and hence, the
> cache expiry. The next goal would be to have Varnish infinitely cache the
> pages with cache invalidation.

That's a very sane goal :)

> it seems all the mechanisms of cache invalidation are manual (using Purge,
> Ban etc.). Is there an automatic way of doing it from the backend? The

Unfortunately, Varnish only speaks HTTP to the backend. There's no way
to automatically do that.

> manual process would be cumbersome as we have separate team for data
> entry/operations and they would have to notify the system person etc. etc.

A different strategy could be to have a "short" TTL, a virtually
infinite grace period (you can also set it via Cache-Control) and make
use of Last-Modified/Etag headers.

This way Varnish will frequently ask your backend (short TTL) but will
probably serve most requests from cache (high grace) and hammer your
backend more often. The last point can be cheap if you implement IMS
properly in your backend.

This way you don't need to involve more teams, the people responsible
for the backend's Cache-Control can now handle grace and conditional
requests.

Cheers



More information about the varnish-misc mailing list