Redisson Multiget - Getting multiple key values in single call form Redisson

Viewed 551

I have a redis cache where each key is of type list and from redisson i want to make a map of each list key and their size...

Below code is working fine but I want to make single call to redis cache.

Iterable<String> keys = redissonClient.getKeys().getKeysByPattern(keyPattern);


    Map<String, Integer> map = new HashMap<>();
    for (String key : keys) {
        map.put(key, redissonClient.getList(key).size());
    }
    return map;
}

Thanks in advance

0 Answers
Related