Cache Override


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


  • Liferay DXP 7.0


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 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 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,replicateUpdatesViaCopy=true


DE-26 and after,replicateUpdatesViaCopy=true


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