Jedis Client的RedisTemplate如何在一次调用中获取多个列表值

How to get multiple list values in one single call in RedisTemplate of Jedis Client

我正在使用 RedisTemplate 获取数据并将其存储为列表。 当我存储数据时 - 我将其存储为

redisTemplate.opsForList().rightPush("key1", "value11");
redisTemplate.opsForList().rightPush("key1", "value12");
redisTemplate.opsForList().rightPush("key2", "value21");
redisTemplate.opsForList().rightPush("key2", "value22");

现在我想在一次调用中获取两个键的列表值 我可以通过

单独获得
redisTemplate.opsForList().range("key1", 0, -1);
redisTemplate.opsForList().range("key2", 0, -1);

但是有没有办法将 multi get 与列表一起使用。如果值是字符串类型,我可以使用多站点,但我看不到任何 api 和列表。

您不需要专用的 API,只需 pipelining

查看一些示例: https://github.com/xetorthio/jedis/blob/master/src/test/java/redis/clients/jedis/tests/PipeliningTest.java