Clear all Varnish cache from python

Arek S

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?

Arek S

Finally I used https://pypi.python.org/pypi/python-varnish

from varnish import VarnishManager as varnish_manager
manager = varnish_manager(('localhost:6082',))
manager.run('stop', secret=current_app.config['VARNISH_SECRET'])
manager.run('start', secret=current_app.config['VARNISH_SECRET'])

work like a charm...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related