2012-11-12 2 views
0

에 아무것도 내가 스프링 MVC의 3.1.X최대 절전 모드 4.1.1.Final를 사용하여 두 제 1 및 제 2 레벨 캐시를 사용하고 저장하지 않습니다. 캐시 작업에 대한 주석을 사용하여 도메인 객체를 구성했습니다. 그러나 캐시는 디스크에 아무 것도 저장하지 않습니다. 도메인 개체에 대한최대 절전 모드 4.1.x의 EHCache는 디스크

<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop> 
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</prop> 
<prop key="hibernate.cache.use_query_cache">true</prop> 
<prop key="hibernate.cache.use_second_level_cache">true</prop> 

Annonation 기반 구성 :

<?xml version="1.0" encoding="UTF-8"?> 
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"> 

    <!-- 
    <diskStore path="java.io.tmpdir"/> 
    --> 
    <diskStore path="java.io.tmpdir/ehcache"/> 
    <defaultCache 
     maxElementsInMemory="10000" 
     eternal="false" 
     timeToIdleSeconds="300" 
     timeToLiveSeconds="120" 
     overflowToDisk="true" 
     maxElementsOnDisk="10000000" 
     diskPersistent="true" 
     diskExpiryThreadIntervalSeconds="120" 
     memoryStoreEvictionPolicy="LRU" 
    /> 
</ehcache> 

최대 절전 모드 캐시 속성 :

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 

여기 내 ehcache.xml 파일입니다

라는 이름의 폴더 **으로 Ehcache의/tmp 폴더에 : **

/tmp folder

답변

1

으로 Ehcache는 저장 만 maxElementsInMemory 객체의 수를 메모리 자체 디스크에 객체를 저장합니다. 이 시점 이후에만 EhCache가 디스크에 개체를 저장하기 시작하기 때문에 많은 수의 개체가 실제로 캐시되고 있는지 확인하십시오.