Caching portlet output

If servlet caching is enabled on the application server, the portlet cache holds the complete output of the portlet by portlet state. As a result, the portal server calls the portlet's service or render methods when the user changes the portlet state.


To enable local caching, check the Enable Servlet Caching option in the administrative console for the application server.

The portlet indicates how long, in seconds, its output should be cached in the portlet deployment descriptor.

JSR 168 cache settings
< expiration-cache > 300 < /expiration-cache >

A value of -1 indicates that the portlet cache never expires. A value of 0 indicates that the portlet is never cached, which is also the behavior if the portlet descriptor does not provide cache settings.

Modifying the local cache at runtime

For JSR 168, the portlet window can modify the expiration time at runtime by setting the EXPIRATION_CACHE property in the RenderResponse, as follows:

RenderResponse.setProperty(
PortletResponse.EXPIRATION_CACHE,
(new Integer(3000)).toString() );





0 Comments To ' Caching portlet output '

Post a Comment