0
什么我使用休眠4.1.1.Final与Spring MVC的3.1.X并同时使用第一和第二级缓存。我使用注释为高速缓存操作配置了我的域对象。但缓存不会在磁盘上存储任何内容。休眠4.1.x版的Ehcache不存储在磁盘上
这是我的ehcache.xml中的文件:
<?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>
Hibernate缓存属性:
<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配置为域对象:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
号命名的文件夹**的Ehcache/tmp文件夹中:**