Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Clear all the cache of a domain

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


abraham.sustaita at buscacorp

Jun 14, 2012, 5:34 PM

Post #1 of 2 (886 views)
Permalink
Clear all the cache of a domain

I use this class PHP (http://varnish-cache.org/wiki/CLI) to clean the
Varnish cache, I only do this:

$var01Obj = new Varnish('192.168.11.41', 6082, 3);
$var01Obj->set_auth('XXXXXXXXXXXX' . "\n");
$ret = $var01Obj->connect();
if ($ret['status']) {
print_r($var01Obj->purge_url($url));
} else {
print_r($ret);
}

where $url is an url of the form ^/news/$ but I have a problem and I need
to delete all the cache of a site, let say, I have www.site.com/news/ and
the news are www.site.com/news/1/title/ and I have 5,000 news, but also I
have other site www.other-site.com with the same friendly urls, so I only
need to clean the cache for www.site.com not for www.other-site.com. If I
make

$url = '^www.site.com.*&';

will it work?

I know ^/news.*$ works since I have some rules like that (for comments for
example), but I have no idea if it will work using the full domain


pprocacci at datapipe

Jun 14, 2012, 6:14 PM

Post #2 of 2 (871 views)
Permalink
Re: Clear all the cache of a domain [In reply to]

Not sure of the capabilities of the class you are using, but you can ban url's
based on req.http.host and the passed url.

ban req.http.host == "example.com" && req.url ~ "/news/.*"

^^ for example.

~Paul


On Thu, Jun 14, 2012 at 05:34:25PM -0700, Abraham Cruz Sustaita wrote:
> I use this class PHP ([1]http://varnish-cache.org/wiki/CLI) to clean
> the Varnish cache, I only do this:
>
> $var01Obj = new Varnish('192.168.11.41', 6082, 3);
> $var01Obj->set_auth('XXXXXXXXXXXX' . "\n");
> $ret = $var01Obj->connect();
> if ($ret['status']) {
> print_r($var01Obj->purge_url($url));
> } else {
> print_r($ret);
> }
>
> where $url is an url of the form ^/news/$ but I have a problem and I
> need to delete all the cache of a site, let say, I have
> [2]www.site.com/news/ and the news are [3]www.site.com/news/1/title/
> and I have 5,000 news, but also I have other site [4]www.other-site.com
> with the same friendly urls, so I only need to clean the cache for
> [5]www.site.com not for [6]www.other-site.com. If I make
>
> $url = '^www.site.com.*&';
>
> will it work?
>
> I know ^/news.*$ works since I have some rules like that (for comments
> for example), but I have no idea if it will work using the full domain
>
> References
>
> 1. http://varnish-cache.org/wiki/CLI
> 2. http://www.site.com/news/
> 3. http://www.site.com/news/1/title/
> 4. http://www.other-site.com/
> 5. http://www.site.com/
> 6. http://www.other-site.com/

> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

________________________________

This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/legal/email_disclaimer/ for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.