avo has asked for the wisdom of the Perl Monks concerning the following question:
In mod_perl environment the data stored in $cache doesn't die after execution of the mod_perl script. The data stays in $cache until a web server restart. The issue I have is that because Apache forks couple of processes each process carry its own copy of this module and $cache. I need fast temporary storage for better response time towards the client. In my application I store the data in $cache until certain moment when the client confirms the data, when I store it in MySQL table. I also tried using tied db like this:package sharedcache; use strict; my $cache; sub store { $cache .= $_[0]; } sub get { return $cache; } 1;
Which had exactly the same issue - each apache process kept its own copy of it. Is there a better way to do that. Thanks.tie %tempdb, 'SDBM_File', $databasefile, O_CREAT|O_RDWR, 0644;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl memory question
by moritz (Cardinal) on Mar 05, 2008 at 14:59 UTC | |
|
Re: mod_perl memory question
by perrin (Chancellor) on Mar 05, 2008 at 16:20 UTC | |
|
Re: mod_perl memory question
by Rhandom (Curate) on Mar 05, 2008 at 15:46 UTC |