ナレッジベース
公開されました May 28, 2026

How to Replicate Custom MultiVM Cache Entries Across Clustered Nodes

written-by

Daniel Martínez Cisneros

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.

Issue

  • When using a custom MultiVM cache in a clustered Liferay DXP environment, entries are not replicating across all nodes.

  • Updates made to the cache on one node are not visible on other nodes, as the cache entries are only being stored locally.

Environment

  • Liferay DXP 2023.Q1+

  • Clustered Environment

Resolution

By default, Liferay's clustered cache mechanism is configured for invalidation rather than replication to optimize performance. This means when a cache entry is updated on one node, other nodes receive a message to remove (invalidate) their local copy of that entry. The data is then re-fetched from the original source on the next request. To change this behavior to direct replication, where the updated object is copied to all other nodes in the cluster, follow these steps:

  1. Ensure that clustering is enabled in your portal-ext.properties file:
    cluster.link.enabled=true
  2. Add the following property to your portal-ext.properties file to enable direct copy replication for your custom cache (replace [CACHE_NAME] with your actual cache name):
    ehcache.replicator.properties.[CACHE_NAME]=replicatePutsViaCopy=true,replicateUpdatesViaCopy=true

Setting the replicatePutsViaCopy and replicateUpdatesViaCopy properties to true ensures that both new entries and updates are propagated with their full values to all nodes in the cluster.

Additional Information

It is recommended to apply this configuration in the portal-ext.properties file rather than in a module-multi-vm.xml file. Future versions of Liferay DXP (2025.x and later) migrate to Ehcache 3.x, which introduces changes to cache configuration. Using portal-ext.properties is a more forward-compatible approach.

did-this-article-resolve-your-issue

ナレッジベース