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.
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.velocitycache.chain) use the H2 cache by default:
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:
For more information on how to configure cache regions to use the H2 Cache provider, please see the Cache Chaining documentation.