Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top