Re: Caching dynamic pages (CGI) for one service/server

From: Henrik Nordstrom <[email protected]>
Date: Thu, 13 May 1999 03:39:10 +0200

Nottingham, Mark (Australia) wrote:

> OK, but what about objects that have no Last-Modified header; will Squid
> cache them if there is a refresh_pattern that covers them?

Yes, if you have a refresh pattern with a min age other than 0. This is
partly why having such a refresh pattern in strongly discouraged (see
squid-users achives for earlier discussions). There sould be a note in
the default squid.conf on this, but I notice there isn't.

> Unfortunately, the note in 13.3 of HTTP/1.1 that says that objects without a
> validator can still be considered fresh; this is madness, IMHO. It assumes
> that script writers will be good enough to mark an object as stale
> if it's dynamic; we all know what a lazy bunch they are ;-)

This is to allow caching of dateless HTTP/1.0 servers where there are no
last-modified equivalence. Query type URLs and POST is explicitly
excluded from this blind caching in the specification, and may not be
cached unless there is a cache validator. This exception is assumed to
catch most dynamic content where caching would hurt, and was true before
the introduction of server side scriptiong (ASP and similar techniques).

First refresh pattern of any Squid using refresh patterns with a min age
other than 0 and not using the recommended no_cache rules MUST use the
following refresh_pattern before any such pattern which applies to HTTP
urls in order to comply with HTTP rules on heuristic expiry calculation:

refresh_pattern \? 0 0% 1420
(the 0% lmfactor can be tuned without any apparent hasard, but HTTP/1.1
requires this to be 0, the max value of 1420 is currently unused but may
prove useful it the change proposed below is made)

If there is control directives that denies caching, request type
indicates uncacheable reply, response code is defined as uncachable or
if the object requires immediate revalidation (refresh_pattern/expire
says it is stale) then the object is not cached.

On subsequent requests:

If override-expire and age < min then FRESH
Else if Expires exists, then STALE/FRESH based on that.
Else if age > max then STALE
Else if override-lastmod and age < min then FRESH
Else if Last-Modified exists then use lm factor to determine if it is
STALE or FRESH
Else if age < min then FRESH
Else STALE

The min age is only used when there is no LMT, or if Expires is
explicitly overridden.

Perhaps it should be changed into something like this?

If age > max then STALE
Else if Expires exists then
   if override-expire and age < min then FRESH
   else trust Expires
Else if Last-Modified exists then
   if age < min then FRESH
   else use lmfactor
Else if default-min-age and age < min then FRESH
Else STALE

--
Henrik Nordstrom
Spare time Squid hacker
Received on Wed May 12 1999 - 19:29:45 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:46:16 MST