O'Reilly logo

Squid Proxy Server 3.1 Beginner's Guide by Kulbir Saini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – calculating the freshness of cached objects

Let's see an example of a refresh_pattern and try to calculate the freshness of an object:

refresh_patten -i ^http://example.com/test.jpg$ 0 60% 1440

Let's say a client requested the image at http://example.com/text.jpg an hour ago, and the image was last modified (created) on the web server six hours ago. Let's assume that the web server didn't specify the expiry time. So, we have the following values for the different variables:

  • At the time of the request, the object age was (6 - 1) = 5 hours.
  • Currently, the response age is 1 hour.
  • Currently, the lm-factor is 1÷5 = 20 percent

Let's check whether the object is still fresh or not:

  • The response age is 60 minutes, which is not more than 1440 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required