Caching web fragments (Intermediate)

In this recipe, we will cover the following topics:

  • What Fragment Caching is and its benefits for web projects
  • Integrating Fragment Caching using Ehcache and Servlet API

We will examine how to implement fragment caching by integrating Ehcache and the Servlet API. We will cache the header of a web page in order to demonstrate how caching can be achieved for sections of a web page or a full web page if needed.

Getting ready

Fragment Caching is a technique used to cache sections of your web page in order to provide speed and increase performance. It is useful when certain elements of the page change frequently or depend on a complicated state, while other parts do not change so often. The Ehcache library provides a ...

Get Instant Effective Caching with Ehcache now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.