perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Gies <r...@livesite.net>
Subject Re: Dollar Self Storage (aka mod_perl children sharing/updating data on a schedule)
Date Thu, 13 Jan 2011 13:59:36 GMT
On 01/03/2011 04:48 PM, Jeff Anderson wrote:
> the goal being that each child will not have to hit a database for every request.
>    
If the reason behind not hitting the database on each request is because 
you don't want to impact your page-response times, know that the Cleanup 
phase happens after the response has been sent to the client.

The below demonstration assigns a cleanup handler which sleeps for 3 
seconds.  You will notice that your pages still load before the snooze 
handler is run.

# ---- Source from: .../httpd.conf ----

PerlModule            Apache2::Testing
PerlCleanupHandler    Apache2::Testing->snooze_handler

# ---- Source from: .../Apache2/Testing.pm ----

package Apache2::Testing;
use strict;
use ModPerl::Util;
our $Seconds = 3;
sub snooze_handler {
   my $phase = ModPerl::Util::current_callback();
   warn sprintf("[%d] %s: is sleeping for %d seconds.\n", $$, $phase, $Seconds);
   sleep $Seconds;
   warn sprintf("[%d] %s: is now awake.\n", $$, $phase);
}
1;


Mime
View raw message