设置属性时,未创建ehcache目录。我正在使用ehcache-core 2.6.9和hibernate-ehcache 4.0.1。
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<diskStore path="/tmp/ehcacheApp1" />
<defaultCache maxEntriesLocalHeap="10000" eternal="false"
timeToIdleSeconds="0" timeToLiveSeconds="1800" diskSpoolBufferSizeMB="80"
maxEntriesLocalDisk="10000000" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU" statistics="true">
<persistence strategy="localTempSwap" />
</defaultCache>
<cache name="blockiscsi" maxEntriesLocalHeap="10000" eternal="false"
timeToIdleSeconds="5" timeToLiveSeconds="10">
<persistence strategy="localTempSwap" />
</cache>
<cache name="org.hibernate.cache.internal.StandardQueryCache"
maxEntriesLocalHeap="5" eternal="false" timeToLiveSeconds="120">
<persistence strategy="localTempSwap" />
</cache>
<cache name="org.hibernate.cache.spi.UpdateTimestampsCache"
maxEntriesLocalHeap="5000" eternal="true">
<persistence strategy="localTempSwap" />
</cache>
</ehcache>更新:--我也尝试过这样做:<diskStore path="user.dir/ehcache" />
我收到了这个日志:
17:53:31.232 [main] WARN net.sf.ehcache.DiskStorePathManager - diskStorePath '/tmp/ehcache' is already used by an existing CacheManager either in the same VM or in a different process.
The diskStore path for this CacheManager will be set to /tmp/ehcache/ehcache_auto_created1431805507138728176diskstore.
To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.发布于 2015-01-06 03:02:14
尝试使用SingletonEhCacheProvider设置以下内容
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>https://stackoverflow.com/questions/27004446
复制相似问题