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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.