下载安卓APP箭头
箭头给我发消息

客服QQ:3315713922

html教程_Squid的refresh-pattern配置教学

作者:Comet     来源: http://www.kokojia.com点击数:749发布时间: 2015-06-26 10:40:25

标签: html教程html视频教程html5教程

Web开发

相信大家对html语言并不陌生,关于Squid的refresh也不例外,下面小编就来讲解html教程中pattern配置的教程方法。

html教程_Squid的refresh-pattern配置教学

refresh_pattern 大概是 squid 最有意思但最不好懂的配置参数了。
记住refresh_pattern 只对后端没设置Expires过期时间的页面起作用,比如论坛页面;而对类似apache mod_expires 设置过的页面不起作用。
说明之前,先将个概念LM,LM就是页面Header里时间(Date)和Last-Modified时间的差。Date一般是Squid从后面取页面的时间,Last-Modified 一般是页面生成时间。
refresh_pattern 的语法是

refresh_pattern [-i] regexp min percent max [options]

regexp 就不讲了,大家都明白的;)
min, max的单位是分钟,percent就是百分比。
refresh_pattern 的算法如下:(当前时间定义为CURRENT_DATE)
1) If ((CURRENT_DATE-DATE(就是LM里定义的时间)) < min),cache是新鲜的
2) else if ((CURRENT_DATE-DATE) < (min + (max-min)*percent),cache是新鲜的
3) else cache是过期的
cache过期就需要从后面server取新鲜内容。
如果希望页面一进入cache就不删除,直到被主动purge掉为止,可以加上ignore-reload选项
一般情况可以使用 reload-into-ims。
举例:
refresh_pattern -i \.gif$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.jpg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.png$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.mp3$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wmv$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.rm$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.swf$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.mpeg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wma$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.css$ 10 50% 60 reload-into-ims
refresh_pattern -i \.js$ 10 50% 60 reload-into-ims
refresh_pattern -i \.xml$ 10 50% 30 reload-into-ims

以上html教程中pattern配置的教程方法,学者们都学会了吗?更多html视频教程可登陆课课家网络教学平台进行查询观看!

赞(26)
踩(0)
分享到:
华为认证网络工程师 HCIE直播课视频教程