Using smarty content caching

Bruce Morrison
2003.05.27

This document is written to give an introduction to using smartys content caching features.
Enabling content caching can significantly improve a sites performance and reduce resource usage.

Smarty caching overview

There are two forms of caching used by smarty, template and content.

Firstly the templates are compiled into php code. These compiled templates are stored until the template files are modified. As a result the templates do not have to be compiled every time they are used. This feature is on by default.

Content caching involves the HTML page itself being cached. Variables from the php script are used to identify the cached file. If a cache item exists that matches the cache identifier the page can be retrieved from the cache, avoiding database accesses and template complication and processing.