3.1.7. cacheStatus()

void cacheStatus ( bool $status [, int $expire] )

Allows to enable/disable output caching for the next executed template and set its expire time (the default is 2 seconds).

Example 3.3. cacheStatus()

  $tpl -> cacheStatus(true, 15);
  $tpl -> parse('template.tpl');

In this example we cache the template template.tpl for 15 seconds. After this time, the cached version is expired and the template engine must generate newer version.

Note that after template execution output caching does not become disabled automatically. In order to disable it, call

$tpl -> cacheStatus(false);

before parsing the next template.

Note: this method is not available, if the Output Caching was removed from the source with OPT Configurator.