Specifying caching timeout
WebSphere Portal supports a feature called the display cache which uses the WebSphere Application Server dynamic cache feature to store portlet output for a specified time before it expires. Requests for that portlet during that time frame draw the content from the cache instead of from the portlet. Display caching is enabled on a portlet-by-portlet basis through an entry in the portlet.xml file. Display caching in the portal is enabled through WebSphere Portal's Web Container Service. You enable it by checking the "Enable Servlet Caching" box on the Servlet Caching tab of the Web Container Service dialog under the WebSphere Portal Application Server definition in the WebSphere Application Server Administration Console.
Since each Web clipping portlet instance is a clone of a concrete portlet, and since caching is typically enabled per concrete portlet instance, normally all Web clipping portlets would inherit the caching setting. This would not be desirable since you may want caching enabled for some, but not all, Web clipping portlets. To get around this, you can specify a CacheTimeout configuration parameter for a specific portlet. If the display cache is enabled for the portal, and if this value is set in a particular Web clipping portlet, the Web clipping portlet will have its output cached for the specified period of seconds.
So, if a Web clipping portlet is rendered on a page, then another page is accessed before returning to this page, all within the specified timeout, portal will pull the Web clipping portlet's output from the display cache instead of invoking the Web clipping portlet again. If the timeout expires, or if a link on the Web clipping portlet is selected, then the Web clipping portlet is re-invoked.
To specify a caching timeout value, set the following configuration parameter in the Web clipping portlet under Portal Administration > Portlets > Manage Portlets > Modify Parameters:
CacheTimeout = ##
Where ## is some number of seconds. Note that this parameter has no effect if the display cache is not enabled for the portal.
By default, cached contents for Web clipping portlets are shared across all Web clipping portlets. If more than one portlet navigates different content from the same URL, then one may return the content that was cached by another. If this is the case, the clipped content is duplicated across the portlets. To prevent this problem, qualify that the cache entry is portlet instance-specific by adding the following configuration parameter:
CacheKeys = portlet
Optionally, you can also qualify that the cache entries should be specific to each user by adding the following configuration parameter:
CacheKeys = portlet,user
See also
- Web clipping
- Create a Web clipping portlet
- Configure URL rewriting
- Accessing content behind a firewall
- Specifying client cookie support
- Changing restart settings
- Specifying authentication options
- Reference: Web clipping limitations
- Troubleshooting portlets