2011-02-28 82 views
1

使用相同的配置,只有defaultCache,我得到不一致的數據(情況A)。但是,如果我添加一個額外的緩存條目不會得到這些不一致的錯誤(情況B)。問題分佈式環境中的defaultCache和緩存(不一致的數據)

你知道爲什麼嗎?

我不想設置130級高速緩存,在預先設定aumaticamente defaultCache

感謝

P. S.我想這有什麼不指定,所有的時間,會的EHCache作爲使用defaultCache設置的模板。

方案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> 

`

案例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> 

回答

0

既然你沒有說如何使用緩存很難猜你真的做什麼,你的意思是不一致的錯誤。

也許你沒有緩存與緩存實體,這使得實體從緩存和查詢從數據庫中讀取查詢結果?有很多可能的情況。

+0

這個問題出現在Liferay門戶和我已經確定它在佈局的時候我在羣集中的一臺機器添加一個portlet,我無法看到它在另一個。正如我所說,如果我把「情況B」的作品,但在「情況A」我看到不一致的數據,我認爲它應該有相同的行爲。 – shilox 2011-02-28 15:39:24

0

我們嘗試在集羣env上運行Liferay並得到相同的錯誤:默認配置不起作用。 我做了一些更改,也許我的配置會幫助你。

hibernate-clustered.xml

liferay-multi-vm-clustered.xml

+0

區別在於我們不是組播。我們正在手動進行peerDiscovery並手動添加defaultCache創建的每個緩存(之前列出,因爲不可能知道它們是哪個緩存)。現在我們發現了不一致的數據問題,但不是在每個緩存中。這很奇怪:S – shilox 2011-03-09 11:06:07