You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jean-Michel Hiver <jh...@mkdoc.com> on 2004/02/05 14:12:16 UTC

[mp1] Serving cached content first, then refreshing

Hi List,


Thanks to help on the list I have writtent the CPAN module
MKDoc::Apache_Cache [1].

At the moment when a cached document has expired from the cache, the
module does the following:

* refresh the cache

* send the newly cached content


I would like make an option so that the reverse could be done, i.e.

* send the expired cached content immediately.

* refresh the cache if it needs to be refreshed and if no other process
  currently does it.


However I am not sure how to go about it... Maybe with a cleanup handler
which would recompute the content and refresh the cache?

Then I have another problem. What if another cleanup handler closed the
database connection before my cleanup handler is executed? It would be
impossible to refresh the content under these conditions.

If I do register a cleanup handler, how can I make sure that it will be
the first cleanup handler to be executed?


Any other ideas?
Cheers,

[1] http://search.cpan.org/~jhiver/MKDoc-Apache_Cache/lib/MKDoc/Apache_Cache.pm
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver@mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp1] Serving cached content first, then refreshing

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2004-02-05 at 08:12, Jean-Michel Hiver wrote:
> However I am not sure how to go about it... Maybe with a cleanup handler
> which would recompute the content and refresh the cache?

Bingo!

> Then I have another problem. What if another cleanup handler closed the
> database connection before my cleanup handler is executed?

Don't do that.  Why would you close the connection?

> If I do register a cleanup handler, how can I make sure that it will be
> the first cleanup handler to be executed?

In my experience, you can't reliably control the order that they run
in.  If you need multiple things done in a certain order, have one
cleanup handler that does several things in the order you require.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html