CGI::Cache 1.4200
Sponsored Links
CGI::Cache 1.4200 Ranking & Summary
File size:
0.043 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1087
Date added:
2006-11-01
Publisher:
Broc Seib
CGI::Cache 1.4200 description
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
Heres 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 << EOF;
< html >< 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
Heres 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 << EOF;
< html >< 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();
print <<EOF;
EOF
CGI::Cache::continue();
print <<EOF;
< /body >< /html >
EOF
# Optional unless youre using mod_perl for FastCGI
CGI::Cache::stop();
This module is intended to be used in a CGI script that may benefit from caching its output. Some CGI scripts may take longer to execute because the data needed in order to construct the page may not be quickly computed. Such a script may need to query a remote database, or may rely on data that doesnt arrive in a timely fashion, or it may just be computationally intensive. Nonetheless, if you can afford the tradeoff of showing older, cached data vs. CGI execution time, then this module will perform that function.
This module was written such that any existing CGI code could benefit from caching without really changing any of existing CGI code guts. The CGI script can do just what it has always done, that is, construct an html page and print it to the output file descriptor, then exit. What youll do in order to cache pages is include the module, specify some cache options and the cache key, and then call start() to begin caching output.
Internally, the CGI::Cache module ties the output file descriptor (usually STDOUT) to an internal variable to which all output is saved. When the user calls stop() (or the END{} block of CGI::Cache is executed during script shutdown) the contents of the variable are inserted into the cache using the cache key the user specified earlier with set_key().
Once a page has been cached in this fashion, a subsequent visit to that page will invoke the start() function again, which will then check for an existing cache entry for the given key before continuing through the code. If the cache entry exists, then the cache entrys content is printed to the output filehandle (usually STDOUT) and a 0 is returned to indicate that cached output was used.
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
Heres 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 << EOF;
< html >< 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
Heres 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 << EOF;
< html >< 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();
print <<EOF;
This is not cached.
EOF
CGI::Cache::continue();
print <<EOF;
< /body >< /html >
EOF
# Optional unless youre using mod_perl for FastCGI
CGI::Cache::stop();
This module is intended to be used in a CGI script that may benefit from caching its output. Some CGI scripts may take longer to execute because the data needed in order to construct the page may not be quickly computed. Such a script may need to query a remote database, or may rely on data that doesnt arrive in a timely fashion, or it may just be computationally intensive. Nonetheless, if you can afford the tradeoff of showing older, cached data vs. CGI execution time, then this module will perform that function.
This module was written such that any existing CGI code could benefit from caching without really changing any of existing CGI code guts. The CGI script can do just what it has always done, that is, construct an html page and print it to the output file descriptor, then exit. What youll do in order to cache pages is include the module, specify some cache options and the cache key, and then call start() to begin caching output.
Internally, the CGI::Cache module ties the output file descriptor (usually STDOUT) to an internal variable to which all output is saved. When the user calls stop() (or the END{} block of CGI::Cache is executed during script shutdown) the contents of the variable are inserted into the cache using the cache key the user specified earlier with set_key().
Once a page has been cached in this fashion, a subsequent visit to that page will invoke the start() function again, which will then check for an existing cache entry for the given key before continuing through the code. If the cache entry exists, then the cache entrys content is printed to the output filehandle (usually STDOUT) and a 0 is returned to indicate that cached output was used.
CGI::Cache 1.4200 Screenshot
CGI::Cache 1.4200 Keywords
CGI
STDOUT
Cache 1.4200
to help
perl extension
CGI scripts
cache
print
scripts
Perl
output
hours
CGI::Cache
CGICache
CGI::Cache 1.4200
Libraries
Bookmark CGI::Cache 1.4200
CGI::Cache 1.4200 Copyright
WareSeeker periodically updates pricing and software information of CGI::Cache 1.4200 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of CGI::Cache 1.4200 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
cachet homes
cache clothing
cached page
cache dresses
tag cache cache center
cache deluxe
elevation of cache county
perl extension implementing
clear cache
cache creek
cgi scripts for forms
perl extensions
cache store
cachets
cachexia
cachetadas
what is cache
صور سكس و مقاطع 19k cached similar pages
Version History
Related Software
Netscape::Cache is a Perl object class for accessing Netscape cache files. Free Download
Net::Google::Cache is a simple OOP-ish interface to the Google SOAP API for cached documents. Free Download
lftpsearch is a set of Perl scripts that are searching for files and directories on FTP servers. Free Download
IRC-Chess project is a 2-player chess game for IRC which turns a computer into an IRC chess bot. Free Download
CGI::FastTemplate is a Perl extension for managing templates, and performing variable interpolation. Free Download
Scriptalicious Perl module can make scripts more delicious to SysAdmins. Free Download
CGI::Wrap is a buffer output when building CGI programs. Free Download
CGI::Test is a CGI regression test framework. Free Download
Latest Software
Popular Software
Favourite Software