H2 Cache Provider - Documentation topics on: cache properties,cache providers,cache settings,configuring the dotcms cache,h2,on disk cache,.

H2 Cache Provider

The H2 cache provider implements a disk cache for dotCMS using the H2 database. For more information on cache providers in dotCMS, please see the Cache Chaining documentation.

What is H2?

The H2 database is a small, fast, open source database with a small footprint. The H2 cache provider uses the H2 database to implement a disk cache for improved performance and faster load times after a server restart. For more information on the H2 database, please see the official H2 database site.

The H2 database and the H2 cache provider are both included with the dotCMS distribution, but the H2 cache provider may only be enabled by customers with an Enterprise license.

Configuration Properties

There are no configuration properties to change the behavior of the H2 cache provider. Specifically, there is no limit to the size of the H2 cache on disk, so on very large sites the H2 cache may grow to a very large size. It is recommended that you use another cache provider in the cache chain (such as the Guava cache provider) before the H2 cache provider, both to improve system performance and to minimize the size of the H2 cache.

Cache Chain Properties

In dotCMS Enterprise edition, only the cache chains for the contentletcache and velocitycache regions (cache.contentletcache.chain and cache.velocitycache.chain) use the H2 cache by default:

cache.contentletcache.chain=com.dotmarketing.business.cache.provider.guava.GuavaCache,com.dotmarketing.business.cache.provider.h2.H2CacheLoader
cache.velocitycache.chain=com.dotmarketing.business.cache.provider.guava.GuavaCache,com.dotmarketing.business.cache.provider.h2.H2CacheLoader

Therefore you must add the H2 cache provider to the cache chain for any other cache regions where you wish to use it. To add the H2 cache provider to the cache chain property for a region, you must add com.dotmarketing.business.cache.provider.h2.H2CacheLoader to the cache chain property for that cache region. For example, the following property specifies a cache chain for the adminconfigpool cache region that accesses the Timed Cache and then the H2 Cache:

cache.adminconfigpool.chain=com.dotmarketing.business.cache.provider.timedcache.TimedCacheProvider,com.dotmarketing.business.cache.provider.h2.H2CacheLoader

For more information on how to configure cache regions to use the H2 Cache provider, please see the Cache Chaining documentation.