-
1. Re: Is it possible to preserve cache data across redeployments?
mgencur Jun 13, 2012 2:57 AM (in response to potemkin)1 of 1 people found this helpfulYou'd probably need to use a cache store to backup the data (FileCacheStore, JDBCCacheStore,...).
The important parameters of a cache would then be purgeOnStartup="false" (on <loader> element) and possibly preload="true" (on <loaders> element). With these settings, the data will be preserved in the cache store over restart and will be preloaded into the memory when you start your app.
-
2. Re: Is it possible to preserve cache data across redeployments?
potemkin Jun 15, 2012 9:35 PM (in response to mgencur)I was thinking about keeping the data in-memory only since I can inject a CacheManager from JNDI which I suppose would exist across redeployments. But FileCacheStore would do.
-
3. Re: Is it possible to preserve cache data across redeployments?
darrellburgan Jun 26, 2012 1:04 PM (in response to potemkin)If the structure of the data being cached changes across redeployments, then the data in the cache will no longer match the Java classes in the new version of the system. Does anyone know what happens if one attempts to get() a cache entry but the class has changed? Will it be some kind of serialization exception?
-
4. Re: Is it possible to preserve cache data across redeployments?
galder.zamarreno Jun 26, 2012 1:51 PM (in response to darrellburgan)Hmmm, not sure what happens in a redeployment, but it'd come down to the update timestamps of each entity. If the entities are updated after the query is done, it would be invalidated. I dunno how redeployemnt affects the query cache though.
-
5. Re: Is it possible to preserve cache data across redeployments?
galder.zamarreno Jun 26, 2012 1:52 PM (in response to galder.zamarreno)Btw, I doubt it's a good idea to use a cache store to persist query cache data cos the structure of the entities could change with the redeployment :|
-
6. Re: Is it possible to preserve cache data across redeployments?
potemkin Jun 26, 2012 7:41 PM (in response to galder.zamarreno)This is mainly for use during development, it'd be nice if restarts didn't lose data so we could test some things more quickly. I gave FileCacheStore a try but it took forever to store and load data from disk so I switched to Google Guava Cache and wrote a small file save/load routine called on startup.
-
7. Re: Is it possible to preserve cache data across redeployments?
mgencur Jun 27, 2012 4:36 AM (in response to potemkin)Have you tried the injection of the CacheManager from JNDI? IMO you could achieve the same results as with the cache store. The cache container/cache manager is managed by the server so it should be possible to inject it to two different applications/deployments.