here is the code would cause the problem in title:
private void getImageFromCache (List<String> skuCodes, Map<String,String> ret) {
RMapCache<String,String> imageCache = redissonClient.getMapCache(Constant.SKU_IMAGES_KEY);
for (String sku : skuCodes){
if (imageCache.containsKey(sku)){
ret.put(sku,imageCache.get(sku)); // this code cause the problem
}
}
skuCodes.removeAll(ret.keySet());
}
i finally found the way to solve the problem by following:
private void getImageFromCache (List<String> skuCodes, Map<String,String> ret) {
RMapCache<String,String> imageCache = redissonClient.getMapCache(Constant.SKU_IMAGES_KEY);
Map<String, String> valueMap = imageCache.getAll(new HashSet<>(skuCodes));
ret.putAll(valueMap);
skuCodes.removeAll(ret.keySet());
}
redisson version:
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.8.0</version>
</dependency>
and it just had about 1k size of the imageCache.
and i want to figure out why,and what did redisson do when i called get() of the RMapCache. thanks.