Reputation: 8971
I am using ehcache with hibernate in my application. here is configuration of 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>
my diskStore path is java.io.tmpdir, which i want to change to my application path as ${WebApp}/DiskStore
Upvotes: 9
Views: 15836
Reputation: 2692
Here you go.
user.home -> It is user home directory e.i C:\Users\abc (windowdrive:\Users\username) user.dir -> C:\Users\abc\eclipse-workspace\project java.io.tmpdir -> C:\Users\abc\AppData\Local\Temp\ ehcache.disk.store.dir - A system property (https://www.ehcache.org/documentation/3.7/)
For more help feel free to communicate over email [email protected]
Thanks
Upvotes: 0
Reputation: 31905
I have tried ehcache recently and was wondering what is java.io.tmpdir
and where it is located on my machine. The accepted answer in this page didnt solve my issue. I checked /tmp
and the ehcache file is not found.
Here's what I find online and hope it helps to other people:
1.run env
command on your terminal. It prints the OS environment. In my case, it gave me:
TMPDIR=/var/folders/1j/pb3h7_hl7890px72_f8mntd00000gn/T/
2.alternatively, you can query from python console:
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'
Upvotes: 1
Reputation: 696
It is also possible to utilise a property that will be replaced on compile time. Therefore, you need to configure your pom.xml properly, e.g.
<build>
<filters>
<filter>${user.home}/my.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
(at least this was a working setting for our project)
Upvotes: 1
Reputation: 5506
Storage Location are specified by hard coading paths.
Legal values for the path attibute are legal file system paths.
E.g., for Unix: /home/application/cache
The following system properties are also legal, in which case they are translated:
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
Subdirectories can be specified below the system property, for example:
java.io.tmpdir/one
becomes, on a Unix system:
/tmp/one
Upvotes: 12