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 for Ehcache is configured here:
<context-param> <param-name>primefaces.CACHE_PROVIDER</param-name> <param-value>org.primefaces.cache.EHCacheProvider</param-value> </context-param>
A dependency...