[Templates] Enabling caching of templates under mod_perl?
Randal L. Schwartz
merlyn@stonehenge.com
Sun, 15 Jul 2007 20:15:38 -0700
>>>>> "Andrew" == Andrew Light <andrewlight7@googlemail.com> writes:
Andrew> I am currently running my web-app under mod_perl, but as far as I can
Andrew> see, none of the dynamic pages, put together using the TT is being
Andrew> chached.
a) Don't create the Template object on each hit.
b) Be sure CACHE_SIZE is undef, or set to a high value.
c) Set COMPILE_DIR to some place that the web process can write.
Step "a" is easy to get wrong, if you're converting CGI code to simply
using the Apache::Registry hack. Be sure you have something like:
our $engine ||= Template->new(...);
rather than:
my $engine = Template->new(...);
which is how it would typically be written in CGI.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!