Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

varnish vcl purging cache selectively

So i am using varnish for the first time. i have spent quite some time reading on how it works, but i am unable to figure out how do i selectively purge the cache.

like say i have a url like this

/?account=123&url=google.com

and another like

/?account=123&url=stackoverflow.com

I need to purge the cache where account=123.

I can only figure out that issuing purge on

/?account=123&url=stackoverflow.com

will only purge the cache where the url matches the incoming url with PURGE method.

Any help is appreciated.

like image 301
Amit Avatar asked Feb 20 '23 21:02

Amit


1 Answers

So this is what works. In varnish 3 selective purge is called ban. so you need to use

ban("obj.http.x-url ~ " + req.url);
like image 98
Amit Avatar answered Feb 27 '23 22:02

Amit