refresh_patternµÄ×÷ÓÃ:
ÓÃÓÚȶ¨Ò»¸oÒ³Ãae½øÈecacheºo£¬ËuÔÚcacheÖÐÍ£ÁoµÄʱ¼a¡£refresh_pattern¹aeÔo½o½oÓ¦Óõ½Ã»ÓÐÃ÷ȹýʱÆÚÏÞµÄÏiÓ¦¡£ÔʼþÎñÆ÷ÄÜʹÓÃExpiresͲ¿£¬»oÕßCache-Control:max-ageÖ¸ÁiÀ´Ö¸¶¨¹ýʱÆÚÏÞ¡£
Ói¨£ºrefresh_pattern [-i] regexp min percent max [options]
min²ÎÊýÊÇÖÖÓÊýÁ¿¡£ËuÊǹýʱÏiÓ¦µÄ×iµÍʱ¼aÏÞÖÆ¡£Èç¹uij¸oÏiӦפÁoÔÚcacheÀiµÄʱ¼aûÓг¬¹ýÕa¸o×iµÍÏÞÖÆ£¬ÄÇôËu²»»a¹ýÆÚ¡£ÀaËƵģ¬max²ÎÊýÊÇ´ae»iÏiÓ¦µÄ×i¸ßʱ¼aÏÞÖÆ¡£Èç¹uij¸oÏiӦפÁoÔÚcacheÀiµÄʱ¼a¸ßÓÚÕa¸o×i¸ßÏÞÖÆ£¬ÄÇôËu±ØÐe±»Ë¢Ð¡£
ÔÚ×iµÍºÍ×i¸ßʱ¼aÏÞÖÆÖ®¼aµÄÏiÓ¦£¬»aÃae¶ÔsquidµÄ×iºoÐÞ¸ÄϵÊýLM-factorËa¨LM-factor=(response age)/(resource age)¡£¶ÔÕaÑuµÄÏiÓ¦£¬squid¼ÆËaÏiÓ¦µÄÄeÁaºÍ×iºoÐÞ¸ÄϵÊý£¬È»ºo½«Ëu×÷Ϊ°ÙÖ±ÈÖµ½øÐбȽϡ£ÏiÓ¦ÄeÁa¼oµ¥µÄ¾ÍÊÇ´ÓÔʼþÎñÆ÷²uÉu£¬»o×iºoÒ»´ÎÑeÖ¤ÏiÓ¦ºo£¬¾ÀuµÄʱ¼aÊýÁ¿¡£Ô´ÄeÁaÔÚLast-ModifiedºÍDateͲ¿Ö®¼aÊDz»Í¬µÄ¡£LM-factorÊÇÏiÓ¦ÄeÁaÓeÔ´ÄeÁaµÄ±ÈÂÊ¡£
³£Óõļ¸¸o²ÎÊýµÄÒa˼
override-expire
¸ÃÑ¡Ïiµ¼ÖÂsquidÔÚ¼i²eExpiresͲ¿Ö®Ç°£¬Ïȼi²eminÖµ¡£ÕaÑu£¬Ò»¸oÇÁaµÄminʱ¼aÈÃsquidµ»ØÒ»¸oδÈÈϵÄcacheÃuÖУ¬¼´Ê¹¸ÃÏiӦ׼±¸¹ýÆÚ¡£
override-lastmod
¸ÄÑ¡Ïiµ¼ÖÂsquidÔÚ¼i²eLM-factor°Ù*Ö±È֮ǰÏȼi²eminÖµ¡£
reload-into-ims
¸ÃÑ¡ÏiÈÃsquidÔÚÈÈÏÇeÇoÀi£¬ÒÔno-cacheÖ¸Ái´«ËÍÒ»¸oÇeÇo¡£»»¾a»°Ëµ£¬squidÔÚת¢ÇeÇo֮ǰ£¬¶Ô¸ÃÇeÇoÔo¼ÓÒ»¸oIf-Modified- SinceͲ¿¡£×¢ÒaÕaµa½o½oÔÚÄ¿±eÓÐLast-Modifiedʱ¼a´Áʱ²ÅÄܹ¤×÷¡£ÍaÃae½øÀ´µÄÇeÇo±£Áono-cacheÖ¸Ái£¬ÒÔ±aËuµ½´iÔʼþÎñÆ÷¡£
Ò»°aÇe¿o¿ÉÒÔʹÓà reload-into-ims¡£ËuÆaʵÊÇÇ¿ÐпØÖƶÔÏoµÄ³¬Ê±Ê±¼a£¬ÕaÎ¥*´ÁËhttpÐÒeµÄ¾«Éñ£¬µ«ÊÇÔÚ´ø¿i½Ïյij¡ºÏ£¬¿ÉÒÔÌa¸ßÃ÷ÏÔϵͳÏaӦʱ¼a¡£
¾ÙÀý£º
refresh_pattern -i \.css$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.xml$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.html$ 1440 90% 129600 reload-into-ims-
refresh_pattern -i \.shtml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.hml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 ignore-reload
refresh_pattern -i \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 1440 90% 129600 reload-into-ims
ignore-reload
¸ÃÑ¡Ïiµ¼ÖÂsquidºoÂÔÇeÇoÀiµÄÈκÎno-cacheÖ¸Ái¡£
ËuÒÔ¡£Èç¹uÏ£ÍuÄÚÈÝÒ»½øÈecache¾Í²»É¾³ý£¬Ö±µ½±»Ö÷¶¯purgeµoΪֹ£¬¿ÉÒÔ¼ÓÉÏignore-reloadÑ¡Ïi,Õa¸oÎÒÃdz£ÓÃÔÚmp3,wma,wmv,gifÖ®Àa¡£
Examples:
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
resource age =¶ÔÏo½øÈecacheµÄʱ¼a-¶ÔÏoµÄlast_modified
response age =µ±Ç°Ê±¼a-¶ÔÏo½øÈecacheµÄʱ¼a
LM-factor=(response age)/(resource age)
¾Ù¸oÀý×Ó,ÕaÀiÖ»¿¼ÂÇpercent, ²»¿¼ÂÇmin ºÍmax
ÀýÈ磺refresh_pattern 20%
¼ÙÉeÔ´*þÎñÆ÷ÉÏwww.aaa.com/index.htm -----lastmodified ÊÇ 2007-04-10 02:00:00
squidÉÏ proxy.aaa.com/index.htm index.htm½øÈecacheµÄʱ¼a 2007-04-10 03:00:00
1£(C)Èç¹uµ±Ç°Ê±¼a 2007-04-10 03:00:00
resource age =3µa-2µa=60ÖÖÓ
response age =0ÖÖÓ
index.htm»¹¿ÉÒÔÔÚcacheÍ£ÁoµÄʱ¼a(resource age)20%=12ÖÖÓ
Ò²¾ÍÊÇ˵£¬index.htm½øÈecacheºo£¬¿ÉÒÔÍ£Áo12ÖÖÓ£¬²Å±»ÖØÐÂÈÈÏ¡£
2£(C)Èç¹uµ±Ç°Ê±¼a 2007-04-10 03:05:00
resource age =3µa-2µa=60ÖÖÓ
response age =5ÖÖÓ
index.htm»¹¿ÉÒÔÔÚcacheÍ£ÁoµÄʱ¼a(resource age)20%=12ÖÖÓ-5=7
LM-factor=5/60=8.3%<20%
Ò»Ö±µ½2007-04-10 03:12:00 LM-factor=12/60=20% Ö®ºo£¬cacheÖеÄÒ³Ãaeindex.htmÖÕÓÚstale¡£
Èç¹uÕaʱûÓÐindex.htmµÄÇeÇo£¬index.htm»aÒ»Ö±ÔÚ»º´aeÖУ¬Èç¹uÓÐindex.htmÇeÇo£¬squidÊÕµ½¸ÃÇeÇoºo£¬ÓÉÓÚÒѾ¹ýÆÚ£¬ squid»aÏoÔ´þÎñÆ÷¢Ò»¸oindex.htmÊÇñÓиıaµÄÇeÇo£¬Ô´þÎñÆ÷ÊÕµ½ºo£¬Èç¹uindex.htmûÓиuУ¬squid¾Í²»Óøuлº´ae£¬Ö±½Ó°Ñ»º´aeµÄÄÚÈÝŻظø¿Í»§¶Ë£¬Í¬Ê±£¬ÖØÖöÔÏo½øÈecacheµÄʱ¼aΪÓeÔ´þÎñÆ÷ÈÈϵÄʱ¼a£¬±ÈÈç2007-04-10 03:13:00£¬Èç¹uÕýºÃÔÚÕa¸oºoÖØÐÂÈÈÏÁËÒ³Ãae¡£ÖØÖúo£¬resource age±a³¤£¬ÏaÓ¦ÔÚcacheÖдae»iµÄʱ¼aÒ²±a³¤¡£
Èç¹uÓиıaÔo°Ñ×iеÄindex.htmµ»Ø¸øsquid,squidÊÕµ½»a¸uлº´ae£¬È»ºo°ÑеÄindex.htmµ»Ø¸ø¿Í»§¶Ë,ͬʱ¸u¾ÝÐÂÒ³ÃaeÖеÄLast_ModifiedºÍÈ¡Ò³ÃaeµÄʱ¼a£¬ÖØмÆËaresource age£¬½øÒ»²½¼ÆËa³o´ae»iʱ¼a¡£
ʵ¼ÊÉÏ£¬Ò»¸oÒ³Ãae½øÈecacheºo£¬ËuµÄ´ae»iʱ¼a¾Íȶ¨ÁË£¬¼´ (resource age) °Ùֱȣ¬Ò»Ö±µ½±»ÖØÐÂÈÈÏ¡£