On Wed, 05 Jan 2005 00:18:54 -0500, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> Store it in an application-specific namespace then, so that each app has
> a separate one but all are cached.
I like the sound of that... How about a configuration something like this:
sub cgiapp_init {
my $self = shift;
$self->tt_config(
TEMPLATE_OPTIONS => {
INCLUDE_PATH => $self->site->config('TEMPLATE_PATH'),
COMPILE_DIR => '/tmp/tt_cache',
},
USE_SINGLETON => 1,
SINGLETON_NAMESPACE => __PACKAGE__, # optional
);
}
Where if you don't provide the namespace, it will default to use one
global singleton, or you can constrain it to a single app (or group of
apps) by providing a namespace (I'm still hesitant to do it
automatically by default).
That should give the developer enough options.
> I can't stress enough that this really makes a difference. By creating
> a new object every time, you are breaking TT's caching system. It has
> to compile the perl code for each template used on every single request.
> It's almost as bad as the difference between CGI and PersistentPerl.
Has anyone done any benchmarks to show how much of a difference it
makes? I'll add a note in the docs for CAP::TT to let users know of
the performance gains...
Thanks for your help and input...
Cheers,
Cees
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates