Hazelcast 如何在JCache中查看缓存内容

Hazelcast 如何在JCache中查看缓存内容,hazelcast,jcache,Hazelcast,Jcache,有使用键读取缓存的选项。像这样: Collection<Integer> userIds = context.getUserDao().allUserIds(); for (Integer userId : userIds) { User user = cache.getUserCache().get(userId); System.out.println(user.toString()); } Collection user

有使用键读取缓存的选项。像这样:

   Collection<Integer> userIds = context.getUserDao().allUserIds();  
   for (Integer userId : userIds) {
        User user = cache.getUserCache().get(userId);
        System.out.println(user.toString());
    }
Collection userid=context.getUserDao().allUserIds();
for(整数userId:userId){
User=cache.getUserCache().get(userId);
System.out.println(user.toString());
}
对于后者,它将把过期的文件加载到缓存中,然后显示出来


但要求查看缓存中当前的所有内容

查看以下链接是否有帮助
查看以下链接是否有帮助

这是如何查看缓存的所有内容。在查看JCache的Java文档后找到了该方法

public void printAllCache(){

    Cache<String, String> cache = cacheManager.getCache(CACHENAME, String.class, String.class);

    Iterator<Cache.Entry<String,String>> allCacheEntries= cache.iterator();
    while(allCacheEntries.hasNext()){
        Cache.Entry<String,String> currentEntry = allCacheEntries.next();
        System.out.println("Key: "+currentEntry.getKey()+" Value: "+ currentEntry.getValue());
    }
    return returnProperties;

}
public void printAllCache(){
Cache Cache=cacheManager.getCache(CACHENAME,String.class,String.class);
迭代器allCacheEntries=cache.Iterator();
while(allCacheEntries.hasNext()){
Cache.Entry currentEntry=allCacheEntries.next();
System.out.println(“键:+currentEntry.getKey()+”值:+currentEntry.getValue());
}
归还财产;
}

这是如何查看缓存的所有内容。在查看JCache的Java文档后找到了该方法

public void printAllCache(){

    Cache<String, String> cache = cacheManager.getCache(CACHENAME, String.class, String.class);

    Iterator<Cache.Entry<String,String>> allCacheEntries= cache.iterator();
    while(allCacheEntries.hasNext()){
        Cache.Entry<String,String> currentEntry = allCacheEntries.next();
        System.out.println("Key: "+currentEntry.getKey()+" Value: "+ currentEntry.getValue());
    }
    return returnProperties;

}
public void printAllCache(){
Cache Cache=cacheManager.getCache(CACHENAME,String.class,String.class);
迭代器allCacheEntries=cache.Iterator();
while(allCacheEntries.hasNext()){
Cache.Entry currentEntry=allCacheEntries.next();
System.out.println(“键:+currentEntry.getKey()+”值:+currentEntry.getValue());
}
归还财产;
}

这只提供了获取已知密钥数据的方法。我想知道的是在不知道密钥的情况下获取缓存的所有内容。这只提供了获取已知密钥数据的方法。我想知道的是在不知道密钥的情况下获取缓存的所有内容。