Using cron to purge cache

MrBiTs mrbits.dcf at
Fri Mar 25 11:38:51 CET 2011

Hash: SHA256

On 03/25/2011 06:54 , Per Buer wrote:
> 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.

I think we can do a nice discussion here. First, and this is a big off-topic here, if I need to purge all contents from time to
time, it's better to create a huge webserver structure, to support requests, change the application a little to generate static
pages from time to time to not increase the database load and forget about Varnish. But this is discussion to another list, another

Second, is this recommended ? I mean, purge all URL, all contents in cache will do varnish to request this content again to backend,
increasing server load and it can cause problems. What to you guys think about it ?

I think it is better to have a purge system (like a message queue or a form to kill some objetcs) to remove only really wanted objects.

If you need to purge all varnish contents, why not just restart varnish from time to time ? But, again, all backend issues must be
considerated here.

- -- 


.0. MrBiTs - mrbits.dcf at
..0 GnuPG  -

Version: GnuPG v1.4.10 (Darwin)


More information about the varnish-misc mailing list