我在应用程序中使用ehcache和hibernate。下面是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>我的diskStore路径是java.io.tmpdir,我想将其改为我的应用程序路径为java.io.tmpdir。
发布于 2012-07-19 11:17:01
存储位置由硬编码路径指定。
路径设置的法律价值是合法的文件系统路径。
例如,用于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 子目录可以在系统属性下面指定,例如:
java.io.tmpdir/one
在Unix系统上变成:
/tmp/1
发布于 2013-06-19 14:42:23
还可以使用在编译时将被替换的属性。因此,您需要正确地配置您的pom.xml。
<build>
<filters>
<filter>${user.home}/my.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>(至少这是我们项目的工作环境)
发布于 2016-11-03 18:30:43
我最近尝试了ehcache,并且想知道java.io.tmpdir是什么以及它在我的机器上的位置。这一页中被接受的答案没有解决我的问题。我检查了/tmp,找不到ehcache文件。
下面是我在网上发现的,希望它对其他人有所帮助:
1.在终端上运行env命令。它打印操作系统环境。就我而言,它给了我:
TMPDIR=/var/folders/1j/pb3h7_hl7890px72_f8mntd00000gn/T/
2.或者,您可以从python控制台查询:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.gettempdir()
'/var/folders/1j/pb3h7_hl7890px72_f8mntd00000gn/T'https://stackoverflow.com/questions/11559464
复制相似问题