首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ehcache diskStore不工作

ehcache diskStore不工作
EN

Stack Overflow用户
提问于 2014-11-18 21:32:19
回答 1查看 1.8K关注 0票数 0

设置属性时,未创建ehcache目录。我正在使用ehcache-core 2.6.9和hibernate-ehcache 4.0.1。

代码语言:javascript
复制
<?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" />

我收到了这个日志:

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-06 03:02:14

尝试使用SingletonEhCacheProvider设置以下内容

代码语言:javascript
复制
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheP‌​rovider</property>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27004446

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档