Legacy Knowledge Base
Published Sep. 10, 2025

Cache Override

Written By

Mariano Alvaro

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

This article describes how to override the cache in 7.0 taking into account two different aspects: EhCache settings and Replication settings. The first one implies creating a new module, while the second is accomplished via portal-ext.properties

Environment

  • Liferay DXP 7.0

Resolution

Cache configuration, as with many other elements of Liferay, can be overridden. This override applies to two different aspects:

EhCache settings

In order to increase your cache's performance, some of their attributes, like the time to idle (timeToIdle), capacity (maxElementsInMemory), can be overridden to apply values different than the ones provided by default. To do so you must create a new module. To help doing so you can use the following project.

Inside, in /portal-cache-override-config/src/main/resources/ehcache/ path, you have an override-liferay-multi-vm-clustered.xml file that applies specific configurations for a provided list of caches. The naming of the file must be the following: override-liferay-[multi|single]-vm-clustered.xml depending on whether you want to override SingleVM or MultiVM caches. Once you have decided the name (hence the type) you must edit your proper cache configurations.

Also the PortalCacheConfiguratorSettingsOverrider.java is provided in order to indicate that the override-liferay-[multi|single]-vm-clustered.xmlwill be used to modify the settings. You must only modify this file to indicate the final name of the xml file.

There is more information about these kinds of overrides in the following article: Modifying the cache configuration with a module

Replication settings

How replication is handled, either via copy or via invalidation (default), can be configured using the appropriate portal-ext.properties properties. These different types of replication can be applied to three different types of operations: puts (put operation over a map), updates (put operation over a key that already exists in a map), removals (remove operation over a map).

The naming of the properties is as follows:

Prior to DE-26

ehcache.cluster.link.replicator.properties

ehcache.cluster.link.replicator.properties.TEST_CACHE=replicatePutsViaCopy=true,replicateUpdatesViaCopy=true

 

DE-26 and after

ehcache.replicator.properties

ehcache.replicator.properties.TEST_CACHE=replicatePutsViaCopy=true,replicateUpdatesViaCopy=true

Additional Information

Additional information can be found here: Modifying Cache Size Time To Live and Replication in DXP 7.0

 

 

Did this article resolve your issue ?

Legacy Knowledge Base