免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3994 | 回复: 13
打印 上一主题 下一主题

[proxy] refresh_pattern求教----------(在线等) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-08-07 18:43 |只看该作者 |倒序浏览
如题:
refresh_pattern ^ftp:                1440        20%        10080
refresh_pattern ^gopher:        1440        0%        1440
refresh_pattern -i \.jpg$        10        20%        10       
refresh_pattern -i \.html$        10        20%        10       
后面的min   %      max

其中的%最难理解.它和min,max这间有什么关系.
例如:我想要.jpg的图片.每5分钟更新一次.怎么写.


我的代理现在大致的情况就是要么有的干脆就不缓存(如.html).要么有缓存的(.jpg)就不过期,永远都是在cache中命中(refresh_pattern -i \.jpg$        5        20%        5  override-expire )5 分钟更新一次,根本不起任何作用.


有做过的高手,请指点迷津

[ 本帖最后由 host-sandylau 于 2006-8-8 18:55 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-08-08 15:50 |只看该作者
refresh_pattern -i \.jpg$        5        20%        5  override-expire

论坛徽章:
0
3 [报告]
发表于 2006-08-08 18:27 |只看该作者
up

[ 本帖最后由 host-sandylau 于 2006-8-8 18:57 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-08-08 18:54 |只看该作者
快快帮忙啊

[ 本帖最后由 host-sandylau 于 2006-8-8 18:56 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-08-09 15:49 |只看该作者
我也搞不清楚,同问一个,不缓存flash文件能不能这样写:

refresh_pattern -i  \.swf$        0        20%        0     reload-into-ims

如果不行的话要怎么写,为达到改目的又有没有多种写法?

论坛徽章:
0
6 [报告]
发表于 2006-08-10 15:45 |只看该作者
我摘抄一些资料给大家分享一下,当然,我对这方面也不是很懂:

You can put any number of refresh_pattern lines in the configuration file. Squid searches them in order for a regular expression match. When Squid finds a match, it uses the corresponding values to determine whether a cached response is fresh or stale. The refresh_pattern syntax is as follows:

refresh_pattern [-i] regexp min percent max [options]
For example:

refresh_pattern -i \.jpg$ 30 50% 4320 reload-into-ims

refresh_pattern -i \.png$ 30 50% 4320 reload-into-ims

refresh_pattern -i \.htm$ 0 20% 1440

refresh_pattern -i \.html$ 0 20% 1440

refresh_pattern -i . 5 25% 2880
The regexp parameter is a regular expression that is normally case-sensitive. You can make them case-insensitive with the -i option. Squid checks the refresh_pattern lines in order; it stops searching when one of the regular expression patterns matches the URI.

The refresh_pattern directive also has a handful of options that cause Squid to disobey the HTTP protocol specification. They are as follows:




override-expire

When set, this option causes Squid to check the min value before checking the Expires header. Thus, a non-zero min time makes Squid return an unvalidated cache hit even if the response is preexpired.




override-lastmod

When set, this option causes Squid to check the min value before the LM-factor percentage.




reload-into-ims

When set, this option makes Squid transform a request with a no-cache directive into a validation (If-Modified-Since) request. In other words, Squid adds an If-Modified-Since header to the request before forwarding it on. Note that this only works for objects that have a Last-Modified timestamp. The outbound request retains the no-cache directive, so that it reaches the origin server.




ignore-reload

When set, this option causes Squid to ignore the no-cache directive, if any, in the request.

论坛徽章:
0
7 [报告]
发表于 2006-08-10 17:50 |只看该作者
谢谢bend兄的帮助,你说的这些其实我都研究过,难道是我了解的肤浅???这些参数我都有一一调试过,可还是未能解决实际问题,要是能用经验把这些及它的参数用中文的方式翻译一下我想我会更进一步了解它们的作用的。


究研了很久,一开始感觉了解很多,现在感觉自己什么都不了解。。。。。。。。。。。。。。。。。。。

[ 本帖最后由 host-sandylau 于 2006-8-10 17:52 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2006-08-11 17:00 |只看该作者
refresh_pattern -i .html 10 90% 2160 reload-into-ims后边这个参数是什么意思?

论坛徽章:
0
9 [报告]
发表于 2006-08-11 18:01 |只看该作者
refresh_pattern指令也有少数选项导致squid违背HTTP协议规范。它们如下:
override-expire
该选项导致squid在检查Expires头部之前,先检查min值。这样,一个非零的min时间让squid返回一个未确认的cache命中,即使该响应准备过期。

override-lastmod
改选项导致squid在检查LM-factor百分比之前先检查min值。

reload-into-ims
该选项让squid在确认请求里,以no-cache指令传送一个请求。换句话说,squid在转发请求之前,对该请求增加一个If-Modified-Since头部。注意这点仅仅在目标有Last-Modified时间戳时才能工作。外面进来的请求保留no-cache指令,以便它到达原始服务器。

ignore-reload
该选项导致squid忽略请求里的任何no-cache指令。



不知道这样说,对不对,你参考一下吧.

论坛徽章:
0
10 [报告]
发表于 2006-08-11 18:19 |只看该作者
我还是不太理解,能通俗一点说吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP