Configure servlet caching
Overview
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 JSP files
- Metadata about the entry, including timeout and entry priority information.
Gotcha: If servlet caching checkbox is set to enabled, it will take precendence over all other types of caching, including SITE caching. This means that if servlet caching is enabled, but not configured correctly, you lose all the benefits of servlet caching and obtain none of the benefits of site caching. If servlet caching is not working, to do NOT leave it enabled.
Configure servlet caching to save the output of servlets and JSP files to the dynamic cache.
To enable servlet caching, verify that the dynamic cache service is enabled.
Unique entries are distinguished by an ID string that is generated from the HttpServletRequest object each time the servlet runs. You 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 JSP files are compiled into servlets, the dynamic cache function treats JSP files the same as servlets, except in specifically documented situations.
Procedure
- In the console, click...
Servers | Application servers | server | Web container settings | Web container | Configuration tab | Enable servlet caching
- Click Apply or OK.
- Restart WAS.
What to do next