How to ensure that the cache is not cleared and can be read even after the application restarts?
xiaolongzuo opened this issue · 3 comments
As stated in the title, I am using version 3.10 of ehcache. After caching some data, I restart the application and the data is gone. However, I have made the following settings.
resourcePoolsBuilder = ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(ehCacheSorStoreConfig.getHeapSize(), MemoryUnit.MB) .disk(ehCacheSorStoreConfig.getDiskSize(), MemoryUnit.MB, true);
I searched all the documents but couldn't find any information about persistence.Why?
Is anyone there?
You filed this issue at 7:40AM in my timezone. One minute later you asked "Is anyone there?" This isn't a commercial support channel.
This section (https://www.ehcache.org/documentation/3.10/getting-started.html#three-tiers) in the documentation describes how to configure a persistent cache. The other important point to note here is that the open source disk store requires that you cleanly shutdown the cache manager in order for persistence to work. If you don't call shutdown on the cache manager, or fail to wait for it to complete then the persistent data will be deleted on startup as it is not known to be clean (and therefore safe). If this is happening then it should be captured in the logging output on startup.
Further details on the disk store can be found here: https://www.ehcache.org/documentation/3.10/tiering.html#disk-tier