Hi, I have being designing a module in Perl which is using a private hash to store some data when certain method is called. It looks like this:
package sharedcache;
use strict;
my $cache;
sub store {
$cache .= $_[0];
}
sub get {
return $cache;
}
1;
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:
tie %tempdb, 'SDBM_File', $databasefile, O_CREAT|O_RDWR, 0644;
Which had exactly the same issue - each apache process kept its own copy of it. Is there a better way to do that. Thanks.