ehcache2.10+spring4 整合要注意的问题


配置ehcache.xml时注意,这个地方之前参考其他博文,有个坑。。timeToIdleSeconds、timeToLiveSeconds这两个属性要注意一下,反正我是被坑惨了,一些博文的配置为timeToIdleSeconds=5,timeToLiveSeconds=5,测试的时候每次都有缓存,结果每次都会重新查询,一直没发现问题所在,偶然之下看到这两属性才发现错误。详细情况请看http://blog.csdn.net/vtopqx/article/details/8522333这篇博文,写得比较具体。


  
  
<ehcache>

  <!-- 磁盘缓存位置 -->
  <diskStore path="java.io.tmpdir/ehcache"/>

  <!-- 默认缓存 -->
  <defaultCache
          maxEntriesLocalHeap="10000"
          eternal="false"
          timeToIdleSeconds="120"
          timeToLiveSeconds="120"
          maxEntriesLocalDisk="10000000"
          diskExpiryThreadIntervalSeconds="120"
          memoryStoreEvictionPolicy="LRU"/>

  <cache name="myCache"
   		maxElementsInMemory="10000"
        maxElementsOnDisk="1000" 
        eternal="false" 
        overflowToDisk="true"
        diskSpoolBufferSizeMB="20" 
        timeToIdleSeconds="300" 
        timeToLiveSeconds="600"
        memoryStoreEvictionPolicy="LFU" />

</ehcache>





  
  


  
  


  
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值