You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Geoffrey Young <gy...@laserlink.net> on 2000/11/15 16:26:38 UTC

[RFC] Apache::Expires

hi all...

I was wondering if anyone has some experience with expire headers for
dynamic documents - kinda like mod_expires but for dynamic stuff.

why?  well, say I have a handler that creates, say, a css document on the
fly based upon fields in a database.  the css contents won't change
regularly (if ever) but every request results in dynamic processing.
Wouldn't it be nice to be able to cache dynamic results if I say it's ok?  

(yes, one could just spit out a static document weekly or whatever, but
that's not the point of this discussion, ok :)

anyone else see an interest in an Apache::Expires (or whatever)?  Is there
something out there already?  I was thinking of working on it if there is
nothing out there, but it would require lots of RFC reading and wrestling
with stuff like entity tags...

comments/experiences welcome...

--Geoff

Re: [RFC] Apache::Expires

Posted by David Hodgkinson <da...@hodgkinson.org>.
Geoffrey Young <gy...@laserlink.net> writes:

> hi all...
> 
> I was wondering if anyone has some experience with expire headers for
> dynamic documents - kinda like mod_expires but for dynamic stuff.

Andy Wardley has already clued me in, in two entirely different ways,
on doing something very similar with the Template Toolkit - I have
modtimes in files I'm templating or records pulled from a database...
 
> why?  well, say I have a handler that creates, say, a css document on the
> fly based upon fields in a database.  the css contents won't change
> regularly (if ever) but every request results in dynamic processing.
> Wouldn't it be nice to be able to cache dynamic results if I say it's ok?  
> 
> (yes, one could just spit out a static document weekly or whatever, but
> that's not the point of this discussion, ok :)

Again, that's the TT way :-)


-- 
Dave Hodgkinson,                             http://www.hodgkinson.org
Editor-in-chief, The Highway Star           http://www.deep-purple.com
      Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -----------------------------------------------------------------

Re: [RFC] Apache::Expires

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

the next alpha release of Embperl 2.0 will have the ability to generate
Expired/Last-Modified headers and handle if-modified-since requests. The
programmer has to provide the time (in seconds) when a document should
expires and/or can provide a function, that tells Embperl if a document has
expired. Upon this data Embperl generates the headers (as far as possible)
and caches the output of the document (or subcomponent). Cacheing is already
working in the current alpha realase (2.0a16) and the http header stuff is
the next I plan to do.

I don't know if this is very usefull for a more general Module, because it's
all written in C and uses Embperl's internal DOM storage, but on the other
side Embperl 2.0 will not only be able to process his own syntax, but also
plain Perl, XML (e.g. XSP), and other custom syntaxes (e.g. SSI and others).

Gerald




----- Original Message -----
From: "Geoffrey Young" <gy...@laserlink.net>
To: <mo...@apache.org>
Sent: Wednesday, November 15, 2000 4:26 PM
Subject: [RFC] Apache::Expires


> hi all...
>
> I was wondering if anyone has some experience with expire headers for
> dynamic documents - kinda like mod_expires but for dynamic stuff.
>
> why?  well, say I have a handler that creates, say, a css document on the
> fly based upon fields in a database.  the css contents won't change
> regularly (if ever) but every request results in dynamic processing.
> Wouldn't it be nice to be able to cache dynamic results if I say it's ok?
>
> (yes, one could just spit out a static document weekly or whatever, but
> that's not the point of this discussion, ok :)
>
> anyone else see an interest in an Apache::Expires (or whatever)?  Is there
> something out there already?  I was thinking of working on it if there is
> nothing out there, but it would require lots of RFC reading and wrestling
> with stuff like entity tags...
>
> comments/experiences welcome...
>
> --Geoff
>
>


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



Re: [RFC] Apache::Expires

Posted by Perrin Harkins <pe...@primenet.com>.
On Wed, 15 Nov 2000, Geoffrey Young wrote:
> I was wondering if anyone has some experience with expire headers for
> dynamic documents - kinda like mod_expires but for dynamic stuff.

We do this, and let mod_proxy use our headers to control its cache and
handle If-Modified requests.

> anyone else see an interest in an Apache::Expires (or whatever)?  Is there
> something out there already?  I was thinking of working on it if there is
> nothing out there, but it would require lots of RFC reading and wrestling
> with stuff like entity tags...

Um, it's pretty easy:

my $last_mod = time;
my $expires  = time + 360; # expires in one hour

$r->header_out('Expires'       => Apache::Util::ht_time($expires));
$r->header_out('Last-Modified' => Apache::Util::ht_time($last_modified));

Or did you have something different in mind?

- Perrin