[Catalyst] Re: modules for conditional GET ?

Aristotle Pagaltzis pagaltzis at gmx.de
Mon Jan 18 10:47:22 GMT 2010

* Dami Laurent (PJ) <laurent.dami at justice.ge.ch> [2010-01-18 08:35]:
> So clients should keep asking for those pages at each request,
> and depending on the If-Modified-Since header and on the
> timestamp for the config file, the server can decide if it's
> worth recomputing the page for that client, or rather send
> a cheap 304 Not Modified.

I suggest you send an ETag and check `If-None-Match` (possibly
just a hash of the timestamp for the config file) instead of
(or if you have HTTP/1.0 clients, in addition to) relying on the
timestamp and `If-Modified-Since`.

Beyond that:

It’s easy to write a module that will conserve bandwidth using
these headers, by hashing the body after all computation is done
and checking whether to send it or just a 304.

But conserving server CPU requires intimate knowledge of both the
model and the structure of the controllers. It seems hard to find
a generically useful abstraction beyond a utility method or two
for setting the headers.

Aristotle Pagaltzis // <http://plasmasturm.org/>

More information about the Catalyst mailing list