ehcache.xml 分布試緩衝,ehcache.xml緩衝

來源:互聯網
上載者:User

ehcache.xml 分布試緩衝,ehcache.xml緩衝

 1 <?xml version="1.0" encoding="gbk"?> 2 <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"> 3      <!-- 緩衝設定為磁碟緩衝,防止重啟tomcat時,app要重新登入  --> 4      <diskStore path="java.io.tmpdir"/> 5     <!-- 叢集多台伺服器中的緩衝 6            注意每台要同步緩衝的伺服器的RMI通訊socket連接埠都不一樣,在配置的時候注意設定--> 7     <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" 8         properties="hostName=10.1.35.111, port=40001,socketTimeoutMillis=2000"/> 9     <!---->10     <cacheManagerPeerProviderFactory 11         class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" 12         properties="peerDiscovery=manual,13         hostName=10.1.35.111,14         port=40002,15         rmiUrls=//10.1.35.111:40001/BaseDataCache|//10.1.35.111:40002/BaseDataCache,16         timeToLive=0"17     />18     <!--19     <cacheManagerPeerProviderFactory 20      class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" 21      properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, 22      multicastGroupPort=4446, timeToLive=32"/> 23     -->24     <!--25     搜尋某個網段上的緩衝:timeToLive26         0是限制在同一個伺服器,1是限制在同一個子網, 32是限制在同一個網站27         ,64是限制在同一個region,128是限制在同一個大洲, 255是不限制  -->28 29     <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="600" timeToLiveSeconds="86400" overflowToDisk="false"/>30     <!-- 31         配置自訂緩衝32         maxElementsInMemory:緩衝中允許建立的最大對象數33         eternal:緩衝中對象是否為永久的,如果是,逾時設定將被忽略,對象從不到期。34         timeToIdleSeconds:快取資料的鈍化時間,也就是在一個元素消亡之前,35                     兩次訪問時間的最大時間間隔值,這隻能在元素不是永久駐留時有效,36                     如果該值是 0 就意味著元素可以停頓無窮長的時間。37         timeToLiveSeconds:快取資料的存留時間,也就是一個元素從構建到消亡的最大時間間隔值,38                     這隻能在元素不是永久駐留時有效,如果該值是0就意味著元素可以停頓無窮長的時間。39         overflowToDisk:記憶體不足時,是否啟用磁碟緩衝。40         memoryStoreEvictionPolicy:緩衝滿了之後的淘汰演算法。41     -->   42     <cache name="BaseDataCache"43         maxElementsInMemory="10000"44         eternal="false"45         overflowToDisk="true"46         timeToIdleSeconds="60000"47         timeToLiveSeconds="600000"48         memoryStoreEvictionPolicy="LFU">49         <!-- 50             RMI緩衝分布同步尋找 class使用net.sf.ehcache.distribution.RMICacheReplicatorFactory51                這個工廠支援以下屬性:52             replicatePuts=true | false – 當一個新元素增加到緩衝中的時候是否要複製到其他的peers。預設是true。53             replicateUpdates=true | false – 當一個已經在緩衝中存在的元素被覆蓋時是否要進行複製。預設是true。54             replicateRemovals= true | false – 當元素移除的時候是否進行複製。預設是true。55             replicateAsynchronously=true | false – 複製方式是非同步指定為true時,還是同步的,指定為false時。預設是true。56             replicatePutsViaCopy=true | false – 當一個新增元素被拷貝到其他的cache中時是否進行複製指定為true時為複製,預設是true。57             replicateUpdatesViaCopy=true | false – 當一個元素被拷貝到其他的cache中時是否進行複製指定為true時為複製,預設是true。58                 asynchronousReplicationIntervalMillis=100059         -->60         <!-- 監聽RMI同步緩衝對象配置 註冊相應的的緩衝監聽類,用於處理緩衝事件,如put,remove,update,和expire -->61         <cacheEventListenerFactory62             class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"63             properties="replicateAsynchronously=true, 64             replicatePuts=true, 65             replicatePutsViaCopy=true,66             replicateUpdates=true,67             replicateUpdatesViaCopy=true, 68             replicateRemovals=true "/>69     </cache>70     71 </ehcache>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.