I have 2 webapps, an admin webapp, and the actual application webapp itself. Both share access to a mysql store and Ehcache is used to cache the user details to prevent a user lookup hit to the backend per REST API request.
The problem I have is that the admin app can be used (rarely I will add) to update the users credentials, lets say the password or username, or change some authorisation level etc. Now when this happens, I need the user cache to be invalidated, or cleared, so that the main webapp can then hit the db upon a user lookup to get the new users details into the cache.
This currently happens, but the clearing of the cache is not visible to the main client webapp.
How do I share a ehcache between two webapps (hosted both in jetty or tomcat)?? I am currently using Jetty but plan to switch to Tomcat.
I am using Spring 3, Jersey, Hibernate, MySQL and Google Ehcache annotations.
thanks for any assistance.
You have several options here:
Ehcache has a REST API that you could deploy as a webapp. That way, both the admin and the application webapp could share a cache.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With