Problem defaultCache and cache in distributed environment (Inconsistent data)

1.3k views Asked by At

Using the same configuration, with only defaultCache, I get inconsistent data (case A). But if I add an additional cache entry will not get those errors of inconsistency (case B).

Do you know why?

I do not want to set the 130 caches that set aumaticamente defaultCache

Thanks in advance

P. S. I guess all the time that what is not specified, will EHCache as a template using defaultCache settings.

Case A:

<defaultCache  
     maxElementsInMemory="10000"  
     eternal="false"  
     timeToIdleSeconds="0"  
     overflowToDisk="false"  

>  
    <cacheEventListenerFactory  
         class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"  

     />  
     <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />  
 </defaultCache>

`

Case B:

<defaultCache  
     maxElementsInMemory="10000"  
     eternal="false"  
     timeToIdleSeconds="0"  
     overflowToDisk="false"  

 >  
     <cacheEventListenerFactory  
         class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"  

     />  
     <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />  
 </defaultCache>  

 <cache  
     name="com.liferay.portal.model.impl.LayoutImpl"  
     maxElementsInMemory="10000"  
     eternal="false"  
     timeToIdleSeconds="0"  
     overflowToDisk="false"  
 >  
     <cacheEventListenerFactory  
         class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"  
     />  
     <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />  
 </cache>  
2

There are 2 answers

1
стривігор On

Since you haven't said how to you use cache it's hard to guess what you are really doing and what errors of inconsistency do you mean.

Maybe you are not caching query results with cached entities, which makes entities to be read from cache and queries from database? There are many possible cases.

1
ninja On

We tried to run Liferay on the cluster env and got the same error: default config doesn't work. I made some changes, maybe my config will help you.

hibernate-clustered.xml

liferay-multi-vm-clustered.xml