Set servlet caching
After a servlet is invoked and completes generating the output to cache, a cache entry is created containing the output and the side effects of the servlet. These side effects can include calls to other servlets or JSPs or metadata about the entry, including timeout and entry priority information. Set servlet caching to save the output of servlets and JSPs to the dynamic cache.
To enable servlet caching, complete Use the dynamic cache service.
Unique entries are distinguished by an ID string that is generated from the HttpServletRequest object each time the servlet runs. We can then base servlet caching on:
- Request parameters and attributes of the URI that was used to invoke the servlet
- Session information
- Other options, including cookies
Because JSPs files are compiled into servlets, the dynamic cache function treats JSPs files the same as servlets, except in specifically documented situations.
- In the admin console, click...
Servers | Application servers | myserver | Web container settings | Web container
- Select Enable servlet caching under the Configuration tab.
- Click Apply or OK.
- Restart WAS.
Next steps
Define the cache policy for the servlets by Set cacheable objects with the cachespec.xml file.