EhCache在特定路径上溢出到磁盘

Rah*_*wal 8 java hibernate ehcache

我在我的应用程序中使用带有hibernate的ehcache.这是ehcache.xml的配置

<ehcache>
    <diskStore path="java.io.tmpdir"/>        

    <defaultCache
            maxElementsInMemory="10"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="300"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
</ehcache>
Run Code Online (Sandbox Code Playgroud)

我的diskStore路径是java.io.tmpdir,我想将其更改为我的应用程序路径$ {WebApp}/DiskStore

NPK*_*PKR 11

存储位置由硬编码路径指定.

路径属性的合法值是合法的文件系统路径.

例如,对于Unix:/ home/application/cache

以下系统属性也是合法的,在这种情况下它们被翻译:

user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path
ehcache.disk.store.dir - A system property 
Run Code Online (Sandbox Code Playgroud)

可以在系统属性下指定子目录,例如:

java.io.tmpdir /个

变成,在Unix系统上:

的/ tmp /个