Cache invalidation in Ehcache?

There are 2 ways to make a change in the database: inside the app & outside the app.

There are 2 ways to make a change in the database: inside the app & outside the app Inside the app you can trigger easily an invalidation. The second one is a harder to solve. Cache elements are stored with a key and based on that key you can delete it.

CacheManager manager = CacheManager.getInstance(); cache = manager. GetCache(cacheName); cache. Remove(key); or cache.removeAll(); Depending how you configured ehcache of course.

But you need to know the name of the cache that holds the object.

This is how you can invalidate all EhCache items without bothering what the individual cache names are: CacheManager manager = CacheManager.getInstance(); String names = manager.getCacheNames(); for (String name : names) { Cache cache = manager. GetCache(name); cache.removeAll(); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions