0

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.

Grant Ho
  • 1
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 11 '23 at 14:30

0 Answers0