Efficient way to get all the key value pair from redis cache using Jedis

You can chunk your keys into arrays[Note1] of keys and call mget.

    public List<String> get(final String[] keys) {
        try (Jedis jedis = jedisPool.getResource()) {
            List<String> values = jedis.mget(keys);
            return values;
        } catch (Exception ex) {
            log.error("Exception caught in mget", ex);
        }
        return null;
    }

Note1: The arrays can be of size 100 or 1000 or any other size depending on your system and preference.