Files
smarty/docs/en/programmers/api-variables/variable-caching.xml

84 lines
3.0 KiB
XML
Raw Normal View History

2004-04-13 11:47:32 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="variable.caching">
<title>$caching</title>
<para>
This tells Smarty whether or not to cache the output of the templates
2006-09-27 06:28:21 +00:00
to the <link linkend="variable.cache.dir">
<parameter>$cache_dir</parameter></link>.
By default this is set to 0 ie disabled. If your templates generate
redundant content, it is advisable to turn on
<parameter>$caching</parameter>, as this will result in significant
performance gains.
</para>
<para>
You can also have
2005-05-27 16:25:02 +00:00
<link linkend="caching.multiple.caches">multiple</link>
2006-09-27 06:28:21 +00:00
caches for the same template.
</para>
<itemizedlist>
<listitem><para>
A value of 1 or 2 enables caching.
</para></listitem>
<listitem><para>
A value of 1 tells Smarty to use the current
<link linkend="variable.cache.lifetime"><parameter>$cache_lifetime</parameter></link>
variable to determine if the cache has expired.
</para></listitem>
<listitem><para>A value of 2 tells Smarty to use the
<link linkend="variable.cache.lifetime"><parameter>$cache_lifetime</parameter></link>
value at the time the cache was generated. This way you can set the
<link linkend="variable.cache.lifetime"> <parameter>$cache_lifetime</parameter></link>
just before <link linkend="api.fetch">fetching</link>
the template to have granular control over when that particular cache expires.
See also <link linkend="api.is.cached"><varname>is_cached()</varname></link>.
</para></listitem>
<listitem><para>
If <link linkend="variable.compile.check"><parameter>$compile_check</parameter></link>
is enabled, the cached content will be regenerated if
2004-04-13 11:47:32 +00:00
any of the templates or config files that are part of this cache are
2006-09-27 06:28:21 +00:00
changed.
</para></listitem>
<listitem><para>
If <link linkend="variable.force.compile">
<parameter>$force_compile</parameter></link> is enabled, the cached
content will always be regenerated.
</para></listitem>
</itemizedlist>
2005-05-27 16:25:02 +00:00
<para>
See also
2006-09-27 06:28:21 +00:00
<link linkend="variable.cache.dir"><parameter>$cache_dir</parameter></link>,
<link linkend="variable.cache.lifetime"><parameter>$cache_lifetime</parameter></link>,
<link linkend="variable.cache.handler.func"><parameter>$cache_handler_func</parameter></link>,
<link linkend="variable.cache.modified.check"><parameter>$cache_modified_check</parameter></link>,
<link linkend="api.is.cached"><varname>is_cached()</varname></link>
and the
<link linkend="caching">caching section</link>.
2005-05-27 16:25:02 +00:00
</para>
2004-04-13 11:47:32 +00:00
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
2006-09-27 06:28:21 +00:00
-->