|Think about Loose Coupling|
Caching a hash?by guice (Scribe)
|on Mar 09, 2006 at 18:20 UTC||Need Help??|
guice has asked for the
wisdom of the Perl Monks concerning the following question:
What are some techniques for caching a hash? I have a rather large Perl script that tends to get a bit heavy in CPU and memory. To assist in alleviating that, I want to start caching some larger hashes (so they don't remain in memory when not needed).
In PHP, I can just serialize an array and write it to a file in /tmp for a "quick cache" and then load it up later on in the script for the specific functions/methods I need it in. But I can't think of any method in Perl that would resemble that. I'm looking for methods using more of the built in Perl methods and/or default Perl modules.
Do you all do hash caching and if so how do you do it?
Before somebody suggests a third party module: it's important to note I have limited access to Perl modules. Code is on an internal system with no Internet access and the requirements to get *anything* added to even just Perl modules is insane. Not to mention we have no local environment to compile code.