Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Calling a function in a defined time interval in mod perl

by Anonymous Monk
on Feb 06, 2005 at 08:44 UTC ( #428459=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Here is the scenario. I have a global hash variable in mod_perl and I use IPC::Shareable module to control the content.To begin with the hash variable is loaded with values from the database by calling a function x(). And I want to call this function every 30 minutes to get the latest from the DB. How would I do that? I am using Apache/mod_perl. Any help is appreciated..
  • Comment on Calling a function in a defined time interval in mod perl

Replies are listed 'Best First'.
Re: Calling a function in a defined time interval in mod perl
by perrin (Chancellor) on Feb 06, 2005 at 17:34 UTC
    Use Cache::FastMmap. It handles the expiration and is many times faster than IPC::Shareable.
      Thanks for your help. I looked at the Cache::FastMmap and it also says BerkeleyDB is the best overall for these kind of processing. I read the BDB document but is there a method (similar to expiration time) in BerkeleyDB that can be used to refresh the information. Also Can I do the following? Write a C app (that will run external from Apache/ModPerl) that will store the information in the BDB and put the CApp in a cronjob to refresh it every 20 minutes? Then all I will do in the perl section is just read the data. I am a newbie and I would appreciate your help.
        I think you'd be better off with Cache::FastMmap because it handles the expiration and can automatically fetch new values from the database when the cached data expires (see the read_cb() method). With BerkeleyDB you would have to do that yourself.
Re: Calling a function in a defined time interval in mod perl
by edan (Curate) on Feb 06, 2005 at 08:50 UTC
      Don't use Apache::Cache. It is much slower than other cache modules, or even MySQL.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://428459]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2016-07-29 22:05 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (264 votes). Check out past polls.