Cache reload - is this the right way to do this?

Jim Hayter jim.hayter at gmail.com
Mon May 14 17:42:39 CEST 2012


On Sat, May 12, 2012 at 6:00 AM, I wrote:

> Varnish 3.0.0 on Ubuntu 11.10.
>
> I am trying to modify my vcl to provide a way to load/update cached pages.
>
> My idea is to check for a specific IP and User-Agent in vcl_recv and return
> pass for a match.  This should by-pass the cache and go to the back end to
> obtain the object.  This seems to work but then my object is not ending up
> in the cache.
>
> If a previous object for the request is in cache, it remains in cache and
> is returned for subsequent requests.  If the object is not in cache, the
> above will not add it to the cache.
>
> Am I missing something or asking varnish to do something it won't by
> design?  Is there another way to accomplish a forced retrieval of a cached
> object and updating the cache with the new object without banning the
> object?
>
> Comments and/or pointers to appropriate doc welcomed.
>

Just to update this, I found one answer.  It is to set
req.hash_always_miss to true.  See
https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh.

After some testing, this seems to be exactly what I was looking for.

Jim



More information about the varnish-misc mailing list