Published May 12th, 2006 in WWW
refresh_pattern may be the most useful and hardest to understand feature of squid.
for chinese version, visit here
Remember refresh_pattern rules apply only to responses without an explicit expiration time. Origin servers can specify an expiration time with either the Expires header, or the Cache-Control: max-age directive.
显示正文 »
refresh_pattern syntax is as follows:
refresh_pattern [-i] regexp min percent max [options]
definitions:
- resource age LM = abs(Last-Modified Time - Date) in headers.
- LM factor = (Current_Date-Date)/LM
refresh_pattern algorithm:
- The response is stale if the response age is greater than the refresh_pattern max value.
- The response is fresh if the LM-factor is less than the refresh_pattern percent value.
- The response is fresh if the response age is less than the refresh_pattern min value.
- Otherwise, the response is stale.
if percent = 50%, see below image for better understanding:

If you want to cache object until it got purged by explicitly command, use ignore-reload option.
you can always cache something for some time using reload-into-ims option.
Examples:
refresh_pattern -i \.gif$ 10 100% 20 ignore-reload
refresh_pattern -i \.jpg$ 10 100% 20 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
Keywords:
Squid,
refresh_pattern,
优化
No Responses to “SQUID优化 refresh_pattern”
Please Wait
Leave a Reply