how storing objects for a given time, regardless of expire info from back-end?

Rob S rtshilston at gmail.com
Mon Apr 12 18:22:28 CEST 2010


Dirk,

The example at 
http://varnish-cache.org/wiki/VCLExampleIgnoreCacheHeadersFromBackend 
should work fine.

In vcl_fetch, pop:

   set obj.ttl = 7200s;

and everything will be cached for 2hrs.

If that doesn't work, then can you post the full VCL you're using.  
We'll take a look, and update the website if necessary.


Rob


Dirk Taggesell wrote:
> Hi all,
>
> I am just trying to get familiar with varnish. I installed the latest
> version 2.1.0 and with the minimal config it works as intended:
>
> backend default {
>     .host = "backend.example.com";
>     .port = "80";
> }
>
> But the back-end sends an expires-header of "0", thus varnish tries to
> fetch the item again from the back-end for every client requesting it.
> So I need a simple rule that tells varnish to just cache every object
> for say 2h, regardless what the back-end says. I just have to prevent
> varnish to ask the back-end at every request.
>
> Unfortunately the config language is not entirely self-explaining. and
> most expamples on the web won't work (too old?).
> Can anyone help me?
>
>   





More information about the varnish-misc mailing list