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 ...

Get Squid Proxy Server 3.1 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.