[Templates-svn] r1058 - trunk/docsrc/lib/option
svn@template-toolkit.org
svn@template-toolkit.org
Author: abw
Date: 2007-04-27 13:21:08 +0100 (Fri, 27 Apr 2007)
New Revision: 1058
Added:
trunk/docsrc/lib/option/stat_ttl
Modified:
trunk/docsrc/lib/option/cache
Log:
updated docs for CACHE_SIZE and added STAT_TTL
Modified: trunk/docsrc/lib/option/cache
===================================================================
--- trunk/docsrc/lib/option/cache 2007-04-27 11:52:01 UTC (rev 1057)
+++ trunk/docsrc/lib/option/cache 2007-04-27 12:21:08 UTC (rev 1058)
@@ -21,11 +21,18 @@
The CACHE_SIZE can be set to 0 to disable caching altogether.
my [* obj *] = [* pkg *]->new({
- CACHE_SIZE => 64, # only cache 64 compiled templates
+ CACHE_SIZE => 64, # only cache 64 compiled templates
});
my [* obj *] = [* pkg *]->new({
- CACHE_SIZE => 0, # don't cache any compiled templates
+ CACHE_SIZE => 0, # don't cache any compiled templates
});
+As well as caching templates as they are found, the Template::Provider
+also implements negative caching to keep track of templates that are
+I<not> found. This allows the provider to quickly decline a request
+for a template that it has previously failed to locate, saving the effort
+of going to look for it again. This is useful when an INCLUDE_PATH includes
+multiple providers, ensuring that the request is passed down through the
+providers as quickly as possible.
Added: trunk/docsrc/lib/option/stat_ttl
===================================================================
--- trunk/docsrc/lib/option/stat_ttl (rev 0)
+++ trunk/docsrc/lib/option/stat_ttl 2007-04-27 12:21:08 UTC (rev 1058)
@@ -0,0 +1,22 @@
+[% TAGS star -%]
+[* DEFAULT
+ obj = '$template'
+ pkg = 'Template'
+-*]
+=item STAT_TTL
+
+This value can be set to control how long the Template::Provider will keep a
+template cached in memory before checking to see if the source template has
+changed.
+
+ my [* obj *] = [* pkg *]->new({
+ STAT_TTL => 60, # one minute
+ });
+
+The default value is 1 (second). You'll probably want to set this to a higher
+value if you're running the Template Toolkit inside a persistent web server
+application (e.g. mod_perl). For example, set it to 60 and the provider will
+only look for changes to templates once a minute at most. However, during
+development (or any time you're making frequent changes to templates) you'll
+probably want to keep it set to a low value so that you don't have to wait
+for the provider to notice that your templates have changed.