I am currently working on a Grails plugin to create a disk persistent cache using EhCache. I have everything working except reloading the cache on restart. I can see that as I use my app, values are being cached correctly. I can see the cache's .data and .index files are created. However, when the app is restarted, both files are cleared out and the cache is not reloaded. I do have the ShutdownListener configured in my web.xml. Any help anyone can provide is appreciated!
<?xml version="1.0" encoding="UTF-8"?>
<!-- I am using this directory only for development -->
(By the way, this forums is essentially closed. You should re-post your question on the terracotta ehcache forum).
The re-build from disk does work in my experience; my guess then is that your application lifecycle is not allowing the cache to be persisted.
It is normal for the .data/.index files to be created on disc persistent caches, but these will be size 0. The size only grows during cache shutdown, assuming there has be no overflow to disc. Upon safe shutdown are those files non-zero?
If they remain zero, try manually shutting down the cache using
just as an experiment. If this works then perhaps the shutdown work is not working as you expect or shutting down too quickly.
Log in to post a comment.