首页 > ehcache缓存 过期时间配置基础问题?

ehcache缓存 过期时间配置基础问题?

设置默认缓存失效时间5分钟无效,5分钟之后仍然可以访问缓存,配置如下:

<?xml version="1.0" encoding="GB2312"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
    <diskStore path="java.io.tmpdir"/>

    <defaultCache 
      maxElementsInMemory="500" 
      eternal="false" 
      timeToIdleSeconds="300" 
      timeToLiveSeconds="300" 
      overflowToDisk="true" />      
</ehcache>

但是,我用下面的方式,配置缓存5分钟之后就失效

<?xml version="1.0" encoding="GB2312"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
    <diskStore path="java.io.tmpdir"/>

    <defaultCache 
      maxElementsInMemory="500" 
      eternal="false" 
      timeToIdleSeconds="300" 
      timeToLiveSeconds="300" 
      overflowToDisk="true" />      

        <cache name="HomeGuideCache" 
        maxElementsInMemory="10000" 
        eternal="false"
        overflowToDisk="false" 
        timeToIdleSeconds="300" 
        timeToLiveSeconds="300"
        memoryStoreEvictionPolicy="LFU" />
        
            <cache name="IHealthTypecache" 
        maxElementsInMemory="10000" 
        eternal="false"
        overflowToDisk="false" 
        timeToIdleSeconds="300" 
        timeToLiveSeconds="300"
        memoryStoreEvictionPolicy="LFU" />


</ehcache>

问题:怎么才能使得系统所有缓存都在5分钟之后失效,也就是都使用默认配置?

【热门文章】
【热门文章】