Prefetching a page from backend after timeout/purge

Anton Stonor stonorn at giraffen.dk
Thu Oct 5 23:21:58 CEST 2006


Varnish looks very promissing--thank you guys for making it happen.

A small question: I've been playing around with VCL and would like 
Varnish to prefetch a fresh page from the backend after a timeout. The 
idea is to spare the end user from waiting for a slow backend the first 
time a page gets fetched after a timeout/purge.

Should'nt this ...

sub vcl_timeout {
     fetch;
}

... do the trick? It doesn't seem to do what I expect.

The same issue when it comes to PURGE. I was hoping you could sneak a 
"fetch" in here, but it doesn't work.

sub vcl_hit {
         if (req.request == "PURGE") {
                 set obj.ttl = 0s;
                 fetch;
                 error 200 "Purged.";
         }
}

Is there a way to let Varnish fetch a fresh page immediately after a PURGE?


/Anton



More information about the varnish-misc mailing list