public static List<String> pipeLineGetStringVal2(List<String> keys,Jedis jedis) {
List<String> dataList = new ArrayList<>();
List<JedisDataException> errorList = new ArrayList<>();
Pipeline pipeline = jedis.pipelined();
for (String key : keys) {
pipeline.get(key);
}
List<Object> objectList = pipeline.syncAndReturnAll();
for (Object result : objectList) {
if (result instanceof String) {
dataList.add((String) result);
}
if (result instanceof JedisDataException) {
errorList.add((JedisDataException) result);
}
}
if (errorList.size() > 0) {
logger.error("pipeLineGet(" + keys + ") error", errorList.get(0));
}
return dataList;
}
网友评论