Configure 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 JSP files or metadata about the entry, including timeout and entry priority information. Configure servlet caching to save the output of servlets and JSP (JSP) files to the dynamic cache.
To enable servlet caching, you must complete the tasks in the Using the dynamic cache service topic.
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 Universal Resource Identifier (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.
- In the console, click Servers > Server Types > WebSphere application servers > server_name > Web container settings > Web container in the console navigation tree.
- Select Enable servlet caching under the Configuration tab.
- Click Apply or OK.
- Restart WebSphere Application Server. Refer to the Managing application servers topic for more information.
What to do next
Define the cache policy for the servlets by Configuring cacheable objects with the cachespec.xml file.
Subtopics
- Dynamic caching with Asynchronous Request Dispatcher
Asynchronous Request Dispatcher (ARD) improves servlet response time when slow operations are logically separated and performed concurrently with other operations required to complete the response.
Related tasks
Configure cacheable objects with the cachespec.xml file Use the dynamic cache service Manage application servers