In EHCache 3.1.3 The 2.x API to set the persistence strategy is missing, for instance the enum net.sf.ehcache.config.PersistenceConfiguration.Strategy
is no longer in the lib.
I've read the docs (for version 3.1). but I couldn't find anything about how to configure the persistence strategy, so I suppose that in version 3.x is a different concept or maybe the feature has been removed, but It sounds a bit odd.
Can anyone tell me how can I to configure the EHCache 3.1.x to manage the persistence like Strategy.LOCALTEMPSWAP
? If It's not possible, Is there any alternative or workaround ?
When configuring the disk tier in Ehcache 3.x there is a boolean value that indicates persistence:
true
: data will be preserved between JVM restarts if the CacheManager
or UserManagedCache
has been shut down properly using one of the close
methods,false
: data will not be preserved between JVM restarts although the disk is used during cache operations. Note that this is the default.Usage depends on where your configuration is sourced from:
ResourcePoolsBuilder.disk(long size, MemoryUnit unit, boolean persistent)
with the boolean as defined above,<ehcache:disk unit="GB" persistent="true">100</ehcache:disk>
with the boolean flag again as defined above.So in order to achieve the equivalent of Strategy.LOCALTEMPSWAP
in 2.x
you just can work with the default.
Note that as of 3.1.3
you can use a system property in the XML to configure the data folder location as in ${java.tmp.dir}
.
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