3.1.15. isCached()

bool isCached ( string $filename [, string $id] )

Returns true, if the specified template with specified ID (optionally) is already cached. Use this method to check, whether you need to get the data from the database:

Example 3.7. isCached()

  if(!$tpl -> isCached('news.tpl'))
  {
    // The news are assigned only if we need to regenerate cache file.
    $tpl -> assign('news', getNews());
  }
  $tpl -> cacheStatus(true, 30);
  $tpl -> parse('news.tpl');

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