Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear all Varnish cache from python

I have a python backend, working as api with Varnish 3.0.7 in front. Every now and then I want to be able to clear varnish cache from my python app - e.i. after some documents have been updated.

I've been trying purge from this tutorial https://www.varnish-cache.org/docs/3.0/tutorial/purging.html but it only purge one object.

I know I can restart varnish but is there any way of deleting all cached objects?

like image 765
Arek S Avatar asked May 06 '26 22:05

Arek S


1 Answers

You can do you it from varnishadmin (varnishadm "ban req.url ~ /"), I'm not sure if there's programmatic way to your requirement.

Update: You might take a look on that project https://github.com/justquick/python-varnish (didn't try it myself).

like image 147
Ievgen Aleinikov Avatar answered May 08 '26 12:05

Ievgen Aleinikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!