Migrate From EHCache to Caffeine
This guide describes how to migrate from EHCache to Caffeine when upgrading from brXM 15.x to 16.y.
In brXM 16, EHCache has been replaced by the Caffeine library. This change affects projects that use custom cache configurations.
Update Custom BinariesServlet Configuration
If your project includes a custom cache configuration for the BinariesServlet, update it to use Caffeine instead of EHCache.
For detailed instructions, see HST Binary Content Resource Serving (BinariesServlet), section 3 (Cache component configuration). Compare your current configuration for brXM 15 with the new configuration for brXM 16, and update your custom settings as needed.
Update CRISP Resources
If your project uses CRISP resources, update the ResourceResolver configurations to use Caffeine instead of EHCache.
In previous versions, EhCacheCache was provided to SpringResourceDataCache:
<bean class="org.onehippo.cms7.crisp.core.resource.SpringResourceDataCache"> <constructor-arg> <bean class="org.springframework.cache.ehcache.EhCacheCache"> <constructor-arg> <bean parent="abstractCrispResourceEhCache"> <property name="cacheName" value="webdamCache" /> <property name="maxEntriesLocalHeap" value="1000" /> <property name="maxEntriesLocalDisk" value="0" /> <property name="timeToLiveSeconds" value="60" /> <property name="timeToIdleSeconds" value="60" /> </bean> </constructor-arg> </bean> </constructor-arg> </bean>
Update your configuration to provide CaffeineCache to SpringResourceDataCache:
<bean class="org.onehippo.cms7.crisp.core.resource.SpringResourceDataCache"> <constructor-arg> <bean class="org.springframework.cache.caffeine.CaffeineCache" factory-bean="caffeineCacheInstanceFactory" factory-method="createSpringCacheInstance"> <constructor-arg value="demomarketoCache" /> <constructor-arg value="initialCapacity=10,maximumSize=1000,expireAfterWrite=100s,expireAfterAccess=100s" /> </bean> </constructor-arg> </bean>
For more information, see Configuring CRISP Addon.
Other Related Changes
Default JMX MBeans for Cache Instances
In brXM 14 and 15, the HST exposed MBeans for each EHCache cache instance. In brXM 16, the HST exposes MBeans for each Caffeine cache instance.
For details, see JMX Management Beans Support.