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

Re: Database driven web content: live or tape?

by Hero Zzyzzx (Curate)
on Jul 19, 2002 at 19:43 UTC ( #183414=note: print w/replies, xml ) Need Help??


in reply to Database driven web content: live or tape?

Another option- Partially live. Use the excellent Cache::Cache to cache your output from HTML::Template, and then feed that to your users. Something like:

my $cache=Cache::FileCache->new(); #options here. . . my $cache_key=$id; #Cache key that uniquely identifies this page my $object=$cache->get($cache_key); my $output; if( not defined $object){ # The page isn't in the cache, or it's expired. # Create your page, piping it through HTML::Template. $cache->set($cache_key,$object,'2 hours'); } else { # The page is in the cache. $output=$object; } print $object;

The cool thing about this is you can delete the page directly from the cache when it's updated, so you can set your expire times pretty long. In this example I'm caching the entire page, but you can (obviously) only cache the very expensive parts of your application, or NOT cache the parts you want to change on each instance.

I like Cache::Cache a LOT, but you really need to benchmark to make sure you're saving time.

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2018-10-22 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?