zoukankan      html  css  js  c++  java
  • 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     搜索某个网段上的缓存:timeToLive
    26         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.RMICacheReplicatorFactory
    51                这个工厂支持以下属性:
    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=1000
    59         -->
    60         <!-- 监听RMI同步缓存对象配置 注册相应的的缓存监听类,用于处理缓存事件,如put,remove,update,和expire -->
    61         <cacheEventListenerFactory
    62             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>
  • 相关阅读:
    统计次数
    使用正则消除行号
    【收集】sql查询统计,周,月,年
    ASP.NET脚本过滤-防止跨站脚本攻击(收集别人的)
    win10环境下jdk1.8+Android Developer Tools Build: v22.3.0-887826的问题
    关于虚拟机的问题解决(转自豆瓣)
    工作
    numpy学习
    deepin Python pycharm安装
    pymysql连接和操作Mysql数据库
  • 原文地址:https://www.cnblogs.com/notnull/p/5229724.html
Copyright © 2011-2022 走看看