CGI::Cache 1.4200
CGI::Cache is a Perl extension to help cache output of time-intensive CGI scripts. WARNING The interface as of version 1.01 has
|
|||||||||||||||||||
CGI::Cache is a Perl extension to help cache output of time-intensive CGI scripts.
WARNING
The interface as of version 1.01 has changed considerably and is NOT compatible with earlier versions. A smaller interface change also occurred in version 1.20.
SYNOPSIS
Here's a simple example:
#!/usr/bin/perl
use CGI;
use CGI::Cache;
# Set up cache
CGI::Cache::setup();
my $cgi = new CGI;
# CGI::Vars requires CGI version 2.50 or better
CGI::Cache::set_key($cgi->Vars);
# This should short-circuit the rest of the loop if a cache value is
# already there
CGI::Cache::start() or exit;
print $cgi->header, "n";
print < body >
< p >
This prints to STDOUT, which will be cached.
If the next visit is within 24 hours, the cached STDOUT
will be served instead of executing this 'print'.
< /body >< /html >
EOF
Here's a more complex example:
use CGI;
use CGI::Cache;
my $query = new CGI;
# Set up a cache in /tmp/CGI_Cache/demo_cgi, with publicly
# unreadable cache entries, a maximum size of 20 megabytes,
# and a time-to-live of 6 hours.
CGI::Cache::setup( { cache_options =>
{ cache_root => '/tmp/CGI_Cache',
namespace => 'demo_cgi',
directory_umask => 077,
max_size => 20 * 1024 * 1024,
default_expires_in => '6 hours',
}
} );
# CGI::Vars requires CGI version 2.50 or better
CGI::Cache::set_key( $query->Vars );
CGI::Cache::invalidate_cache_entry()
if $query->param( 'force_regenerate' ) eq 'true';
CGI::Cache::start() or exit;
print "Content-type: text/htmlnn";
print < body >
< p >
This prints to STDOUT, which will be cached.
If the next visit is within 6 hours, the cached STDOUT
will be served instead of executing these 'prints'.
< /p >
EOF
CGI::Cache::pause();
tags
Download CGI::Cache 1.4200
Authors software
|
|
Similar software
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other software in this category
|
|
|
|
|
|
|
|
|
|
Featured Software
jEdit 4.3 pre8
jEdit is an Open Source text editor written in Java
Opera 9.02
Surf the Internet in a safer, faster, and easier way with Opera browser
GNU Aspell 0.60.4
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell
- Communications
- Database
- Desktop Environment
- Games
- Internet
- Multimedia
- Office
- Programming
- Science and Engineering
- System
- Text Editing&Processing
