Caching happens on multiple levels.

>From roughly easiest to hardest:

By default, when a template source is compiled into Perl, that Perl is
then compiled into bytecodes, and the bytecodes are more or less
permanent in memory.

If you set CACHE_SIZE (see Template::Provider's doc), then only that
many templates are cached in memory.

You can also define COMPILE_DIR or COMPILE_EXT (or both), and then the
translated Perl source code is also cached to disk.

If you're running a web server, you can place a reverse-proxy-cache in
front of your server, and cache entire page-loads.

You can also cache "in memory" some intermediate results of computing
your data, by storing things into the "global" namespace.  For example:

  [%
    IF NOT global.hard_to_compute;
      INCLUDE expensive/module/that/sets/global.hard_to_compute;
    END;
  %]

Then all future hits in that process will already have the data.

(I'm doing all of the above at www.stonehenge.com.)

There's a module by Perrin in the "todo" directory and posted to this
list once or twice that cache's the result of a given "INCLUDE" based
on the invariant parameters.  I'm not sure if that's ever going to be
a core feature, but it sure looks slick.  I may start using that (or
something like that) soon for my menubars.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <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!

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to