Varnish is a reverse web proxy accelerator that caches the HTTP contents. It can speed up requests by a factor of 500-1000 times. By caching and saving CPU time and database requests for content, varnish is able to server hundreds of consecutive requests per second.
In order to purge or clear Varnish cache, you can simply restart Varnish. This will clear the varnish cache.
or if you are using ‘services’ on your server, you can run the following on the command line
service varnish restart
In order to purge varnish cache for a specific URL, using CURL :
curl -X PURGE URL-to-PURGE
Running this command should provide an output like this :
200 Varnish cache has been purged for this object.
Error 200 Varnish cache has been purged for this object.
Varnish cache has been purged for this object.
Varnish cache server
Clearing the varnish cache for a specific URL using varnishadm
To open the varnishadm console. use the following command to purge the URL http://www.example.com/some/url :
varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret ban "req.http.host == example.com && req.url == /some/url/"