Configure portlet fragment caching
After a portlet is invoked and completes generating the output to cache, a cache entry is created, containing the output and the side effects of the portlet. These side effects can include calls to other portlets or metadata about the entry, including timeout and entry priority information. Configure portlet fragment caching with the WebSphere Application Server administrative console to save the output of portlets to the dynamic cache.
To enable portlet fragment caching, complete the steps in the Using the dynamic cache service topic.
Unique entries are distinguished by an ID string that generates from the PortletRequest object each time the portlet runs. We can then base portlet fragment caching on:
- Request parameters and attributes
- Session information
- Portlet-specific information, portlet session, portlet window ID, portlet mode, and portlet window state
Tasks
- In the administrative console, click...
Servers > Server Types > WebSphere application servers > server > Portlet container settings > Portlet container > Application servers > server tree.
- Select Enable portlet fragment cache under the Configuration tab.
- Click Apply or OK.
- Restart WAS.
Refer to the Managing application servers topic for more information about managing the application servers.
What to do next
Define a cache policy for our portlets. Note that portlets are not cached unless an applicable caching policy is defined in a cachespec.xml file. Refer to the Configuring cacheable objects with the cachespec.xml file topic for general task information about defining a cache policy. Refer to the Configuring caching policies for portlets topic for information about defining portlet-specific aspects in a cache policy.
Subtopics
- Configure caching policies for portlets
Fragment caching for portlets requires defined a cache policy in a cachespec.xml file, either within the portlet WAR file or globally. If no caching policy is defined and applicable to a particular portlet, that porlet is not cached.
Related:
Portlets Configure portlet fragment caching with the wsadmin tool Use the dynamic cache service Manage application servers Configure cacheable objects with the cachespec.xml file Portlet container settings