squid批量更新缓存方法
时间:2015-12-08 17:26 来源:linux.it.net.cn 作者:IT
需要GCC所以先安装下
yum install gcc gcc-c++ unzip
下载工具包
https://github.com/kormoc/SquidPurge
解压
unzip SquidPurge-master.zip
cd SquidPurge-master
make
中间没有出错就OK
./purge -help
可以查看帮助文档
清除Squid缓存示例:
1、清除 URL 以“.swf”结尾的缓存文件(例如 http://www.test.com/left.swf)
./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se '\.swf$'
注释:
-c:squid.conf location, default “/usr/local/squid/etc/squid.conf”,我这里的目录是不一样的,所以的加上。
-p: 缓存文件的访问地址,从本机的80端口。
-P:清除缓存文件。
-se:匹配的正则表达式。
2、清除URL中包含test.com的所有缓存:
./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se 'test.com'
也可以将程序推到后台去执行,让它慢慢地去清Squid缓存,同时将输出内容记录到purge.log文件:
./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se 'test.com' > purge.log 2>&1 &
(责任编辑:IT)
需要GCC所以先安装下 yum install gcc gcc-c++ unzip 下载工具包 https://github.com/kormoc/SquidPurge 解压 unzip SquidPurge-master.zip cd SquidPurge-master make 中间没有出错就OK ./purge -help 可以查看帮助文档 清除Squid缓存示例: 1、清除 URL 以“.swf”结尾的缓存文件(例如 http://www.test.com/left.swf) ./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se '\.swf$' 注释: -c:squid.conf location, default “/usr/local/squid/etc/squid.conf”,我这里的目录是不一样的,所以的加上。 -p: 缓存文件的访问地址,从本机的80端口。 -P:清除缓存文件。 -se:匹配的正则表达式。 2、清除URL中包含test.com的所有缓存: ./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se 'test.com' 也可以将程序推到后台去执行,让它慢慢地去清Squid缓存,同时将输出内容记录到purge.log文件: ./purge -c /etc/squid/squid.conf -p localhost:80 -P 1 -se 'test.com' > purge.log 2>&1 & (责任编辑:IT) |