Compatibility with Previous Versions
Comparison of Disk Usage Options
The following table summarizes the configuration options for disk usage in Ehcache 2.6 and higher as compared with previous versions.
Disk Usage | Ehcache 2.6 (and higher) | Ehcache 2.5 and Earlier |
Fast Restartability with Strong Consistency | persistence strategy="localRestartable" synchronousWrites="true" | Not available |
Fast Restartability with Eventual Consistency | persistence strategy="localRestartable" synchronousWrites="false" (Enterprise only) | Not available |
Persistence for Clustered Caches | persistence strategy="distributed" | Remove or edit out any disk persistence configuration elements |
Non-Fault-Tolerant Persistence | Use one of the fault-tolerant options above* | overflowToDisk="true" diskpersistent="true"** |
Temporary Storage Tier | persistence strategy="localTempSwap" | overflowToDisk="true" diskPersistent="false" |
In-memory Only (no disk usage) | persistence strategy="none" | |
*It is recommended to use one of the fault-tolerant options, however non-fault-tolerant persistence is still available. If <persistence> has not been specified, you can still use overflowToDisk="true" diskPersistent="true".
**In Ehcache 2.5 and earlier, cache persistence on disk for standalone Ehcache is configured with the overflowToDisk and diskPersistent attributes. If both are set to "true", cached data is saved to disk asynchronously and can be recovered after a clean shutdown or planned flush. To prevent corrupt or inconsistent data from being returned, checking measures are performed upon a restart, and if any discrepancy is found, the cache that was stored on disk is emptied and must be reloaded from the data source.
Upgrading from Ehcache 2.5 and Earlier
After upgrading from a version of Ehcache previous to 2.6, it is strongly recommended to add the <persistence> sub-element to your cache configuration, and to delete, disable, or edit out disk persistence configuration elements from previous versions. The previous elements include:
overflowToDisk diskPersistence DiskStoreBootstrapCacheLoaderFactory Note: If any of the elements above are specified in the same configuration with either the <persistence> sub-element or the <terracotta> sub-element, it will cause an Invalid Configuration Exception.
After upgrading, however, it is not mandatory to add the <persistence> sub-element. In Ehcache 2.6 or higher, disk persistence configuration elements from previous Ehcache versions will continue to be available with the same functionality, as long as the <persistence> sub-element has not been specified.
For cache persistence on disk, you should continue to use the overflowToDisk and diskPersistent attributes. For more information, refer to the "Persistence" section in the Ehcache 2.5 documentation.