Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

framework to handle timeouts/internal caching?

by infidel2112 (Acolyte)
on Oct 04, 2004 at 20:19 UTC ( #396376=note: print w/replies, xml ) Need Help??


in reply to Web app frameworks - I am totally confused!

Hi...I have a related question...

I deal with many cgi scripts that must perform time consuming processes, I'm looking for a framework or module that handle cleanly what I'm cobbling together manually.

To prevent timeouts, currently I write a CGI::Session id, fork a child, send the browser a session cookie and page with a meta refresh on it. The browser refreshes, sending the id, until the child query is done.

Second I also use Memoize to store responses to certain time consuming sql queries, and a few subroutine calls.

I can only cache for about an hour to keep things fresh however. So I have to do a fair amount of work to accomplish that (normalize functions, and deleting stale data), I also had to modify the source to use the locking version of storable calls so multiple processes can use the cache file.

Third I make extensive use of expires and cache-control headers etc, but often requests are different enough that the script still has to be hit.

Basically I just want to have a framework that handles the above, without having to roll so much of my own.

any suggestions? thanks

  • Comment on framework to handle timeouts/internal caching?

Replies are listed 'Best First'.
Re: framework to handle timeouts/internal caching?
by fglock (Vicar) on Oct 04, 2004 at 21:01 UTC

    I can only cache for about an hour to keep things fresh however. So I have to do a fair amount of work to accomplish that ...

    Cache::Cache can help you here.

    my $cache = new Cache::FileCache( ); my $result = $cache->get( "result" ); if ( not defined $result { $result = expensive_function(); $cache->set( "result", $result, "1 hour" ); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://396376]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2021-06-20 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (95 votes). Check out past polls.

    Notices?