|
@@ -278,13 +278,19 @@ public class VideoAdThompsonScorerV2 {
|
|
|
|
|
|
private Map<Long, CreativeStatistic> batchFindCreativeRedisCache(String keyPrefix, List<AdPlatformCreativeDTO> adIdList) {
|
|
private Map<Long, CreativeStatistic> batchFindCreativeRedisCache(String keyPrefix, List<AdPlatformCreativeDTO> adIdList) {
|
|
Map<Long, CreativeStatistic> resultMap = new HashMap<>();
|
|
Map<Long, CreativeStatistic> resultMap = new HashMap<>();
|
|
- for (AdPlatformCreativeDTO dto : adIdList) {
|
|
|
|
- String redisKey = keyPrefix + dto.getCreativeId();
|
|
|
|
- String value = redisHelper.get(redisKey);
|
|
|
|
|
|
+ List<String> redisKeys = adIdList.stream()
|
|
|
|
+ .map(dto -> keyPrefix + dto.getCreativeId())
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<String> values = redisHelper.getValues(redisKeys);
|
|
|
|
+ for (int i = 0; i < adIdList.size(); i++) {
|
|
|
|
+ Long cid = adIdList.get(i).getCreativeId();
|
|
|
|
+ String value = values.get(i);
|
|
if (StringUtils.isNotBlank(value)) {
|
|
if (StringUtils.isNotBlank(value)) {
|
|
- resultMap.put(dto.getCreativeId(), gson.fromJson(value, CreativeStatistic.class));
|
|
|
|
|
|
+ resultMap.put(cid, gson.fromJson(value, CreativeStatistic.class));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|