Caching IBM Web Content Manager elements

You can apply caching to elements by using "connect" tags to reference elements within presentation templates instead of the component or element tag.

Important:

Example: Applying custom caching

This is an example of the type of tag that can be used to cache individual elements within a presentation template.

<connect
 SRV="cmpnt" PATH="/Library/SiteArea/Content"
 SOURCE="library" CMPNTNAME="TestNav" CONTENTCACHE="site" EXPIRES="REL 9000s">
</connect>
Table 1. Connect tag details
Parameter Details
SRV="cmpnt" The Service for this Module is "cmpnt".
PATH="/libraryname/SiteArea/Content" This sets the context for the element.

The "sitepath" and "name" placeholders can be used instead of "PATH=" when caching menus or navigators:

[placeholder tag="sitepath"]/[placeholder tag="name"]
SOURCE="library" Source is either "content", "sitearea" or "library". In this example it is "library" because the element we are caching comes from a component.
CMPNTNAME="TestNav" This is the name of the element to be cached.
CONTENTCACHE="site" This is either "site or "session".
EXPIRES="REL 9000s" The time the component will expire from the cache is set here.

The first time the presentation template is rendered, the element will be added to the cache. The next time the presentation template is rendered, the element will be displayed from the cache instead of being rendered afresh by the Web Content Manager application. Not until it is expired from the cache will the element be rendered again by the Web Content Manager application. For this reason, only elements that do not require to be freshly rendered every time a page is accessed should be cached.

If you are caching a component that is used in more than one presentation template, it is best practice to save the connect tag as a HTML component and then reference that component in each presentation template. If you then need to change the cached component tags, you only need to change it in the HTML component rather than in multiple presentation templates.

If you have a set of cached components that use the same "Expires" setting, then it is best practice to save the "Expires=" parameter as a HTML component and then reference that component in each connect tag used to cache components. If you then need to change the "Expires=" parameter, you only need to change it in the HTML component rather than in multiple connect tags. This also applies to any common cache tags.

Example: Disabling caching

You can also use this method to disable caching. In this example the property CONTENTCACHE=NONE is used to disable caching of this element.

<connect
 SRV="cmpnt" PATH="/SiteArea/Content"
 SOURCE="library" CMPNTNAME="TestNav" CONTENTCACHE="none" >
</connect>