Cache invalidation with regex

Cosimo Streppone cosimo at
Fri Nov 29 13:49:26 CET 2013

On 11/29/2013 11:01 AM, Geoff Simmons wrote:
> On 11/28/2013 06:29 PM, Alexandre wrote:
>> I will wish to invalidate my cache using a regex.
>> example: ^/image.php?a=1&b=2*
>> I would like to disable all url starting with ^/image.php?a=1&b=2
>> Do you have an idea for my problem?
> The '*' in a regular expression is not like a file glob, it means that
> the character before it, in your case the '2', can appear 0 or more times.
> So your regex matches anything starting with:
> /image.php?a=1&b=

I made a simple shell script wrapper to the varnish admin.
It is available here:

If you run it with:

  $ ./ -h

it will show some usage instructions.
In particular:

  $ ./purge-cache -r '^/image\.php\?a=1&b=2.*'

should purge the URLs you asked for.

It worked for me at least, and I added
to my varnish puppet module, to always have it available
alongside reload-vcl etc...


More information about the varnish-misc mailing list