<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>$cache_lifetime</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Smarty Manual"> <link rel="up" href="api.variables.html" title="Chapter 12. Smarty Class Variables"> <link rel="prev" href="variable.cache.dir.html" title="$cache_dir"> <link rel="next" href="variable.cache.handler.func.html" title="$cache_handler_func"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">$cache_lifetime</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="variable.cache.dir.html">Prev</a> </td> <th width="60%" align="center">Chapter 12. Smarty Class Variables</th> <td width="20%" align="right"> <a accesskey="n" href="variable.cache.handler.func.html">Next</a> </td> </tr> </table> <hr> </div> <div class="sect1" title="$cache_lifetime"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="variable.cache.lifetime"></a>$cache_lifetime</h2></div></div></div> <p> This is the length of time in seconds that a template cache is valid. Once this time has expired, the cache will be regenerated. </p> <div class="itemizedlist"><ul class="itemizedlist" type="disc"> <li class="listitem"><p> <em class="parameter"><code>$caching</code></em> must be turned on (either 1 or 2) for <em class="parameter"><code>$cache_lifetime</code></em> to have any purpose. </p></li> <li class="listitem"><p> A <em class="parameter"><code>$cache_lifetime</code></em> value of -1 will force the cache to never expire. </p></li> <li class="listitem"><p>A value of 0 will cause the cache to always regenerate (good for testing only, to disable caching a more efficient method is to set <a class="link" href="variable.caching.html" title="$caching"><em class="parameter"><code>$caching</code></em></a> = 0). </p></li> <li class="listitem"><p> If you want to give certain templates their own cache lifetime, you could do this by setting <a class="link" href="variable.caching.html" title="$caching"> <em class="parameter"><code>$caching</code></em></a> = 2, then set <em class="parameter"><code>$cache_lifetime</code></em> to a unique value just before calling <a class="link" href="api.display.html" title="display()"><code class="varname">display()</code> </a> or <a class="link" href="api.fetch.html" title="fetch()"><code class="varname">fetch()</code></a>. </p></li> </ul></div> <p> If <a class="link" href="variable.force.compile.html" title="$force_compile"> <em class="parameter"><code>$force_compile</code></em></a> is enabled, the cache files will be regenerated every time, effectively disabling caching. You can clear all the cache files with the <a class="link" href="api.clear.all.cache.html" title="clear_all_cache()"><code class="varname">clear_all_cache()</code></a> function, or individual cache files (or groups) with the <a class="link" href="api.clear.cache.html" title="clear_cache()"><code class="varname">clear_cache()</code></a> function. </p> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="variable.cache.dir.html">Prev</a> </td> <td width="20%" align="center"><a accesskey="u" href="api.variables.html">Up</a></td> <td width="40%" align="right"> <a accesskey="n" href="variable.cache.handler.func.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top">$cache_dir </td> <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td> <td width="40%" align="right" valign="top"> $cache_handler_func</td> </tr> </table> </div> </body> </html>