-
1. Re: How to clear entire cache manager?
jombo Mar 10, 2011 10:31 AM (in response to amalrajvinoth)refering to the api of DefaultCacheManager :
When the system shuts down, it should call stop()
on the CacheManager. This will ensure all caches within its scope are properly stopped as well
but this is only work for single JVM and all caches is still available for other node if u use cluster。
if u dont want stop the CacheManager and just want to clear all the entries , i think u can get all the caches and invoke the clear() method for each.
Set<String> set = cacheManager.getCacheNames(); Iterator<String> iterator = set.iterator(); while(iterator.hasNext()){ String cacheName = iterator.next(); Cache<String,Object> cache = cacheManager.getCache(cacheName); cache.clear(); }
-
2. Re: How to clear entire cache manager?
amalrajvinoth Mar 10, 2011 11:57 PM (in response to jombo)I feel ur reply will def work.
Thank u very much.
-
3. How to clear entire cache manager?
galder.zamarreno Mar 11, 2011 11:15 AM (in response to amalrajvinoth)In forthcoming 5.0.0.Beta1, you'll be able to remove a cache cluster wide via removeCache() call in EmbeddedCacheManager - https://issues.jboss.org/browse/ISPN-905
Note that jombo's suggestion will only clear the named caches defined in the XML or programmatically via defineConfiguration() method because getCacheNames() is limited to returning that. This won't return all running caches in that cache manager. In fact, probably a getRunningCacheNames() is needed to provide all names of caches running, both predefined, and the ones generated at runtime based on the default configuation (i.e. when getCache(name) is called and that cache is not within the named or defined ones). I'll start a dev list to discuss this.
-
4. How to clear entire cache manager?
galder.zamarreno Mar 11, 2011 11:23 AM (in response to galder.zamarreno)Btw, I've created a discussion around my last comment in http://lists.jboss.org/pipermail/infinispan-dev/2011-March/007579.html - in case you wanna chip in
-
5. How to clear entire cache manager?
jombo Mar 13, 2011 10:00 PM (in response to galder.zamarreno)it seems that i dont understand this method clearly. sorry to amal
-
6. How to clear entire cache manager?
galder.zamarreno Mar 22, 2011 8:33 AM (in response to jombo)Jombo, your suggestion will work as expected since https://issues.jboss.org/browse/ISPN-981 was resolved.