Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_perl share variables across child processes

Tags:

perl

mod-perl

I have a mod_perl system accepting API calls from different client systems Suppose in the child perl program I have calls like this which does some heavy processing

$conf{$client_id} = generate_client_conf($client_id); # returns a ref to a hash

I would like to re-use this variable $conf{$client_id} in other child processes How can I do this ?

The variables cannot be loaded at startup.pl ,but needs to be cached once it is generated

like image 916
Ram Avatar asked Oct 24 '13 12:10

Ram


1 Answers

You should use Cache::FastMmap

In mod_perl, just open the cache at the global level in the appropriate module, which is executed as the server is starting and before it starts forking children, but you'll probably want to chmod or chown the file to the permissions of the apache process.

like image 164
edem Avatar answered Oct 04 '22 22:10

edem