Is there a way to see if a particular key exist in cacheManager (org.springframework.cache.CacheManager
) as i am unable to find a way to do that as there is no containsKey
option. I would appreciate if someone could show me a way to check if a key exist in cacheManager. Below are few things i have tried so far -
Cache cache=null;
for (String name : cacheManager.getCacheNames()) {
cache=cacheManager.getCache(name);
System.out.println("-------------->"+cache.get("dummyCache").get()); //this will give me null pointer exception as there is no dummyCache
}
I would like add if/else check to see if a dummyCache
key exist in cache