Varnish made some changes in how you clear the cache in Varnish 3. Hence the confusing title. However, it’s simple to clear the cache now, by using the “ban” command.

[:$] varnishadm -T ban.url /index.html

There are a few things you should be aware of. Varnish can run on different ports than 6089, so if you receive the following error:

Connection failed

It’s either because the IP address or the port that Varnish is listening on isn’t correct. A simple method to check this is to use the netstat command.

[:$] netstat -plnt
tcp 0 0* LISTEN 14142/varnishd

Here we see varnish is listening on the IP address and port 2222.

So to clear/purge/ban the cache we just modify our command line command as follows

[:$] varnishadm -T ban.url /index.html

And you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *

Get actionable training and tech advice

We'll email you our latest articles up to once per week.