On 9/9/07, Peter Hartzler <[EMAIL PROTECTED]> wrote:
> Right, they have to be in memory *while in use*.  Then they can be
> forgotten, e.g., not cached in TT's cache, and when needed again, pulled
> from the one central copy provided by memcached.

Well, yes, but you'd have to recompile them again every time you fetched them.

I think what you're missing here is that there are two layers of
caching in TT.  One is caching of compiling the template into perl
source code.  This is what gets cached on disk.  The other is
compiling the perl source code into a compiled perl subroutine
reference.  This is what is separate in each process.

There is currently no way to share a compiled subroutine ref between
processes, except through the copy-on-write sharing that happens when
you preload the templates.

So, there's really no gain to be had from memcached other than saving
the disk read that happens when a template is first requested in a new
process.

Your idea of unloading compiled templates after use could save memory,
but it would also make TT run about 10 times slower in most
situations.  I believe that all you need to do to try this is turn off
the in-memory caching, which will make TT act the same way it does in
a non-persistent CGI environment.

- Perrin

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to