I have a requirement wherein
I have to place a data structure (Perl hash) in memory, so that each HTTP process (running a Perl script) will use that hash.
The hash structure is around 300 MB.
The environment is mod_perl
I thought of creating a module to load at Apache start that creates a hash in a shared region and returns a reference to it.
Can you please comment on the behaviour, or suggest alternative solutions. Also please point to some good resources to check the examples.
I would be thinking in terms of handing it around via
Storable
store
it to a file,retrieve
it at start.If it needs to change, you'd need to use
flock
to arbitrate IO, and potentially some sort of mechanism for checking when it changed last (e.g. check mtime).