In most cases, the Hotaru smartCache is a better choice for caching blocks of HTML because it automatically updates itself according to changes on your site.
However, if you have a block of HTML that is not or doesn't need to be dependent on database updates, the cacheHTML() function maybe a better alternative to implement.
Example:
$label = 'thumbnails'; // check for a cached version and use it if not expired: $output = $h->cacheHTML(60, '', $label); if ($output) { return $output; // cached HTML } $output = // HTML CODE HERE $h->cacheHTML(60, $output, $label); // make or rewrite the cache file
Other caching options: Standard Database Cache | Hotaru smartCache | Memory Cache