[Catalyst] template toolkit caching

Perrin Harkins perrin at elem.com
Thu May 31 20:11:01 GMT 2007


On 5/31/07, John Goulah <jgoulah at gmail.com> wrote:
> Thanks for the feedback.  Yes I was looking more for a way to cache the
> compiled templates in memcache.  The reason being with many servers the
> compiled template could  be shared amongst the servers so that its only
> compiled once.  Maybe that doesn't buy much, but it probably depends on how
> many templates and servers are in the mix-

Maybe less than you think.  TT uses a two-step caching process.
First, it compiles your template to perl code and caches that
generated code to disk.  This step is the slowest part, and it's done
once per machine.  That's what you would be saving by using memcached
-- one compile per template per machine.  This compile doesn't happen
again until you change the templates.

The second step is loading that perl code and compiling it to a sub in
memory.  That happens once per process and no external cache can help
with it, since it's compiled perl code in memory.

- Perrin



More information about the Catalyst mailing list