How does Luck know how long to cache each response?

Does varnish just use the Cache-Control header from the source server?

And are there other ways you can control how long it caches the response? For example, can you say that Varnish caches the response “indefinitely” (ie, “Until further notice”), and then later explicitly instructs it to remove this object from the cache when you know that the underlying data has changed?

(Note: I have never used Varnish, I'm just trying to decide if this will be suitable for the upcoming project.)

+7
source share
1 answer

These are very simple questions. I think you should start by reading large documents at https://www.varnish-cache.org/docs/

To answer your question: it depends on how you set up the varnish.

You can leave the defaults so that they can use expires;

You can configure it to use different TTL (Time To Live) for each domain / backend / file / cookie ...

If you installed it using ie. 1year cache TTL, you can remove it from the cache by "Clearing" a specific address / URL or the entire domain.

You can do this in two ways:

  • PURGE HTTP method, if configured in your vcl file
  • using the purge command in the varnishadm / lnn console

https://www.varnish-cache.org/docs/2.1/tutorial/purging.html

+5
source

All Articles