Jon*_*ham 3 caching infinispan spring-boot
有没有办法查看cacheManager(org.springframework.cache.CacheManager)中是否存在特定的键,因为我无法找到一种方法来做到这一点,因为没有containsKey选项。如果有人可以向我展示一种检查缓存管理器中是否存在密钥的方法,我将不胜感激。以下是我迄今为止尝试过的一些事情 -
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
}
Run Code Online (Sandbox Code Playgroud)
我想添加 if/else 检查以查看dummyCache缓存中是否存在密钥
| 归档时间: |
|
| 查看次数: |
10664 次 |
| 最近记录: |