The DiskStore can optionally be configured to persist between CacheManager and Virtual Machine instances. See documentation on the diskPersistent cache attribute for information on how to do this.
When diskPersistent is turned on for a cache, a Virtual Machine shutdown hook is added to enable the DiskStore to persist itself. When the Virtual Machine shuts down, the the hook runs and, if the cache is not already disposed, it calls dispose. Any elements in the MemoryStore are spooled to the DiskStore. The DiskStore then flushes the spool, and writes the index to disk.
The cache shutdown hooks will run when:
The cache shutdown hooks will not run when:
If dispose was not called on the cache either by CacheManager.shutdown() or the shutdown hook, then the DiskStore will be corrupt when the application is next started. If this happens, it will be detected and the DiskStore file will be automatically truncated and a log warning level message is emitted. The cache will work normally, except that it will have lost all data.