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.
Important: There is a newer version of the H2 cache in recent versions of dotCMS.
It is recommended that you use the new H22 cache instead of the original H2 cache (this document), unless you have a specific need for the older H2 cache provider (such as compatibility with older plugins). While both the H2 and H22 cache providers use the same H2 database to implement the cache, the H22 cache provider has increased performance, more configuration options, and additional improvements over the H2 cache.
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
The H2 cache provider is not enabled by default, and it is recommended that you use the H22 cache provider instead unless you have a specific need for the older H2 cache provider.
To use the H2 cahce provider, you must add it to the cache chain for any 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, please see the Cache Chaining documentation.