我正在寻找一种清除Varnish中所有域名和所有URL缓存的方法。
目前,我需要为每个URL发出单独的命令,例如:
curl -X PURGE http://example.com/url1
curl -X PURGE http://example.com/url1
curl -X PURGE http://subdomain.example.com/
curl -X PURGE http://subdomain.example.com/url1
// etc.
当我正在寻找一种方法来做某事时
curl -X PURGE http://example.com/*
那将清除example.com下的所有URL,以及example.com子域中的所有URL,基本上是Varnish管理的所有URL。
有什么办法可以实现这个目标吗?
这是我的当前VCL文件:
vcl 4.0;
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
# Command to clear the cache
# curl -X PURGE http://example.com
if (req.method == "PURGE") {
return (purge);
}
}