Template::Context::Cacheable - profiling/caching-aware version of Template::Context
Template::Context::Cacheable::configure_caching( \&My::Favourite::Cache::Engine::get, \&My::Favourite::Cache::Engine::put, );
Enables profiling and caching of Template-Toolkit subtemplates, that can improve template processing speed many times.
Inside any template you can use cached subtemplates. See example:
[% PROCESS subtemplate.tt param_name_1 = 'value_1' param_name_2 = 'value_2' __cache_time = 60 %]
Here __cache_time parameter enables caching and sets caching time in seconds. If __cache_time value is negative, subtemplated will be cached forever (actually it will be cached for 12 hours ;)
param_name_X is examples of parameters, which combination will be used as a hash key.
The following functions / methods are available:
Install cache get / put handlers.
Here are protypes for get / put handlers which illustrates parameters which they will receive:
sub get { my ($key) = @_;
... }
sub set { my ($code, $key, $keep_in_seconds) = @_;
Overloaded Template::Context::process method
No functions is exported.
Walery Studennikov, <despair at cpan.org>
<despair at cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Template::Context::Cacheable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Context::Cacheable
CPAN shell
perl -MCPAN -e shell install Template::Context::Cacheable
For more information on module installation, please visit the detailed CPAN module installation guide.