Cache invalidation with regex

Alexandre infos at opendoc.net
Fri Nov 29 14:18:17 CET 2013


Thank you very much. This is exactly what I want. I'll try to test the 
script in the day.

Good day.

Alex.

On 29/11/13 13:49, Cosimo Streppone wrote:
> 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:
>
> https://gist.github.com/cosimo/890217
>
> If you run it with:
>
>    $ ./purge-cache.sh -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