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
Open-source Ehcache offers a limited version of persistence, as noted in this document. Fast Restart provides enterprise-ready crash resilience with an option to store a fully consistent copy of the cache on the local disk at all times.
All the data is kept in the authority tier, which is slower but more abundant. Data stores supported by Ehcache include: On-Heap Store - Utilizes Java's on-heap RAM memory to store cache entries. This tier utilizes the same heap memory as your Java application, all of which must be scanned by the JVM garbage collector.
ehcache. overflowToDisk — Sets whether the disk store persists to disk between restarts of the Java Virtual Machine. The default value is true.
Overview. In this article, we will introduce Ehcache, a widely used, open-source Java-based cache. It features memory and disk stores, listeners, cache loaders, RESTful and SOAP APIs and other very useful features.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With