The Hazelcast cache provider can be implemented as either a local or distributed memory-only cache for dotCMS. For more information on cache providers in dotCMS, please see the Cache Properties documentation.
- What is Hazelcast?
- Hazelcast in dotCMS
- Cache Chain Properties
- Configuration Properties
What is Hazelcast?
Hazelcast is a leading, open-source, in-memory data grid framework that provides protocols and services to enable simmplified distributed computing services including caching, processing, queries, clustering, and storage. dotCMS currently utilizes Hazelcast for both distributed cluster and cache management.
For more information about Hazelcast, please visit the official Hazelcast website.
Hazelcast in dotCMS
The Hazelcast cache provider included with dotCMS can be used to enable either a Hazelcast distributed or local (“near”) cache. This cache provider is not enabled by default; customers with an Enterprise license may change the default cache region or individual cache regions to use the Hazelcast cache (instead of, or possibly in addition to, the default Caffeine cache provider).
- The Hazelcast cache provider is primarily intended for use as a distributed cache for use with clusters.
- It is recommended that you do not use the Hazelcast cache provider with a stand-alone dotCMS server implementation.
- The Hazelcast cache provider is independent of the Hazelcast features implemented for dotCMS clusters.
- Neither the configuration nor the operation of the Hazelcast cache provider has any effect on Hazelcast features implemented with dotCMS clusters, and you may use a cache provider other than the Hazelcast cache provider with dotCMS clusters without any impact on cluster performance.
Cache Chain Properties
The Hazelcast cache is not configured to be used with any cache regions by default. You must explicitly configure the Hazelcast cache provider for all cache regions where you want to use it.
Embedded (Near) Cache
To configure the Hazelcast cache provider in embedded (or “near”) mode, you must add the following cache provider to the appropriate cache chain:
Distributed (Client) Cache
To configure the Hazelcast cache provider in distributed (or “client”) mode, you must add the following cache provider to the appropriate cache chain:
For example, to use the embedded (“near”) Hazelcast cache in place of the Caffeine cache for all cache regions specified in the default dotCMS configuration, you must replace
com.dotmarketing.business.cache.provider.hazelcast.HazelcastCacheProviderEmbedded in both the default cache region and all cache regions where the Caffeine cache is currently specified. For example, the following configuration settings replace the Caffeine cache with the Hazelcast cache in the default cache chain configuration shipped with dotCMS:
cache.default.chain=com.dotmarketing.business.cache.provider.hazelcast.HazelcastCacheProviderEmbedded cache.velocitymemoryonlycache.chain=com.dotmarketing.business.cache.provider.hazelcast.HazelcastCacheProviderEmbedded cache.contentletcache.chain=com.dotmarketing.business.cache.provider.hazelcast.HazelcastCacheProviderEmbedded,com.dotmarketing.business.cache.provider.h22.H22Cache cache.velocitycache.chain=com.dotmarketing.business.cache.provider.hazelcast.HazelcastCacheProviderEmbedded,com.dotmarketing.business.cache.provider.h22.H22Cache
For more information on how to configure cache regions to use the Hazelcast Cache provider, please see the Cache Chaining documentation.
Since Hazelcast is used for much more than just caching, please see the following important Hazelcast configuration documentation:
- Hazelcast Cluster Transport Configuration
Cache Region Size
You may change the size of the Hazelcast cache region by editing the Hazelcast configuration files in your dotCMS distribution.
Note: It is strongly recommended that you make all changes to the Hazelcast configuration files through a configuration plugin.
Embedded (Near) Cache Size Configuration
If Hazelcast cache is being run as Embedded or “near cache” then the cache size can be set in the
max-size property can be set in Bytes:
<map name="identifiercache"> <max-size>50000</max-size> <eviction-policy>LFU</eviction-policy> </map>
Client (Far) Cache Size Configuration
If Hazelcast cache is being run as Client or “far cache” then the cache size can be set in the
max-size property can be set in Bytes:
<near-cache name="identifiercache"> <max-size>50000</max-size> <eviction-policy>LFU</eviction-policy> <in-memory-format>OBJECT</in-memory-format> </near-cache>