Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: DBI : local persistent storage

by Thilosophy (Curate)
on May 25, 2005 at 08:02 UTC ( #460262=note: print w/replies, xml ) Need Help??

in reply to DBI : local persistent storage

If you are using mod_perl or FastCGI you can store the data in memory, using a persistent variable (such as a package global). That is very easy to do, but does not work with vanilla CGI. If the data needs to be periodically refreshed, it cannot be shared among the mod_perl processes, but if that data is small, at least the memory penalty of having to store many copies (one in each process) is not an issue.

You can store (almost) any kind of Perl data to disk (or shared memory) with the core module Storable.

If you do not want to roll the code yourself, check the various Cache modules on CPAN.

As for the timestamp, I would include that in the cached data. You can then compare it after retrieving from the cache.

Replies are listed 'Best First'.
Re^2: DBI : local persistent storage
by merzy (Scribe) on May 25, 2005 at 09:13 UTC
    Thilosophy has some good suggestions, and I'll second the one for Cache::FileCache as a quick and easy way to get things cached locally.
      The only trouble is, it's dirt slow. It's slower than a simple query on MySQL. You'd be better off using Cache::FastMmap.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://460262]
[Happy-the-monk]: Discipulus: are there any perl monks in Milano?
[Discipulus]: i the moment likely no
[karlgoethebier]: i wonder now it will be with my glasses.
[Discipulus]: Milan Perl Mongers seems frozen at 2009
[Discipulus]: karl you dont shoot with eyes, you shoot with the soul
[jkva]: Reminds me of Guardians of the Galaxy

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-10-20 10:04 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (260 votes). Check out past polls.