Wednesday 24 January 2007 5:05:00 pm
There are numerous caching options with eZ Publish. This section gives an overview of the different cache types, what they do and when you should use them.
The following diagram shows a typical pagelayout.tpl main template file. Its elements can be divided into the template cache and the content view cache.
The cache-block mechanism makes it possible to reduce the processing time of the main template, which often contains a lot of dynamic elements. It is used to instruct the system to store and reuse cached blocks of template code based on different conditions. The cache-block mechanism is described later in this article.
Recall from the second article in this series that the viewcache stores the HTML/XHTML output from a node view the first time it is accessed (and is thus dynamically generated). For subsequent page requests, eZ Publish serves the particular page from the viewcache, reducing server load and page load times. eZ Publish automatically clears the cache when new content is published or modified.
When this setting is enabled, the system generates the viewcache when an object is published, as opposed to when it is first accessed. Enabling PreViewCache can slow down the publishing process, but it is useful on busy sites to ensure that an uncached article cannot be accessed at the same time by several people (as is the case with the viewcache); it would have been cached before the first article view. PreViewCache is a sub-setting for the viewcache, and therefore only has an effect if ViewCaching is enabled. For maximum performance on a production server, template cache and viewcache should always be enabled. Below are the recommended configuration settings:
site.ini.append.php: [ContentSettings] ViewCaching=enabled PreViewCache=enabled [TemplateSettings] TemplateCache=enabled TemplateCompile=enabled TemplateOptimization=enabled
TemplateCompile and TemplateOptimization will be explained in the template section in the second half of this article.