Using partial response caching

There are two methods for caching dynamic content from JSP and Servlets:

  1. The entire response

  2. Part of the response

Fragment caching, also known as partial response caching allows you to cache parts of a response. This allows you to create “template pages” that contain static and dynamic data separated into individual fragments. As with regular dynamic response caching, you control different caching parameters. By configuring each fragment to be sensitive to different page parameters, the page designer ensures that you do not get stale or incorrect data.

Fragment caching is more effective than caching entire responses when pages contain volatile content. For example, you can use fragment caching when the response contains volatile content, such as calculation results, mixed with static content such as headers and footers.

Partial response caching is supported by a tag library for use in JSPs, and a public API for use in servlets. “Using the caching tag library” describes how to use the tag library. Class CacheManager describes the API for use in servlet code.