Using cron to purge cache

Per Buer perbu at
Fri Mar 25 10:54:47 CET 2011

Hi Nuno.

On Fri, Mar 25, 2011 at 10:47 AM, Nuno Neves <nfn at> wrote:
> Hello,
> I have a file named varnish-purge with this content that it's executed daily
> by cron, but the objects remain in the cache, even when I run it manually.
> --------------------------------------------------------------------------------------------
> #!/bin/sh
> /usr/bin/varnishadm -S /etc/varnish/secret -T "url.purge .*"

url.purge will create what we call a "ban", or a filter. Think of it
as a lazy purge. The objects will remain in memory but killed during
lookup. If you want to kill the objects from cache you'd have to set
up the ban lurker to walk the objects and expunge them.

If you want the objects to actually disappear from memory right away
you would have to do a HTTP PURGE call, and setting the TTL to zero,
but that means you'd have to kill off every URL in cache.

Per Buer, Varnish Software
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
Varnish makes websites fly!
Want to learn more about Varnish?

More information about the varnish-misc mailing list