Reducing page load time using content caching

Reducing the page load time can be done by caching the HTML content after initial rendering. PrimeFaces' cache component can be used to cache the content. It supports two providers that enable content management in a cache store. The first provider is for Ehcache (http://ehcache.org) and the second one for Hazelcast (http://hazelcast.com/products/hazelcast).

In this recipe, we will use Ehcache—an open source, standard-based cache used to boost performance, offload the database, and simplify scalability. We will explain how the cache component works in an example with a feed reader wrapped inside the p:cache tag.

Getting ready

The cache provider is configured via a context parameter in web.xml. The provider ...

Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.