自己成功使用ehcache集群的總結

總結:其實很簡單,畢竟人家做成了產品的東西就不是考你的智商的,代碼如下,注意rmi端口沖突問題

 

 
<!-- rmi遠程cache服務 -->
 <cacheManagerPeerProviderFactory
  class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
  properties="peerDiscovery=manual,
     socketTimeoutMillis=2000,
     rmiUrls=//10.79.6.172:40000/baseParam" />
 
 <!-- rmi本地cache服務 -->
 <cacheManagerPeerListenerFactory
  class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
  properties="hostName=10.79.6.177, port=40000, socketTimeoutMillis=2000"
 />
  
 <cache name="baseParam"
    maxElementsInMemory="1000"
    eternal="false"
    timeToIdleSeconds="2000"
    timeToLiveSeconds="2000"
    overflowToDisk="false">
    <cacheEventListenerFactory
   class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
   properties="replicateAsynchronously=true, replicatePuts=true,
                     replicatePutsViaCopy=true, replicateUpdates=true,
                     replicateUpdatesViaCopy=true, replicateRemovals=true,
                     asynchronousReplicationIntervalMillis=200" />
 </cache>
 本文由用戶 jeli007 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!