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文件夾中:**