缓存判定问题处理

This commit is contained in:
Chopper 2021-08-04 16:01:20 +08:00
parent 5ee25262aa
commit d93e11b302

View File

@ -107,8 +107,8 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
// redis 排序中下标从0开始所以这里需要 -1 处理
count = count - 1;
Set<DefaultTypedTuple> set = cache.reverseRangeWithScores(CachePrefix.HOT_WORD.getPrefix(), count);
if (set.isEmpty() || set == null) {
return null;
if (set == null || set.isEmpty()) {
return new ArrayList<String>();
}
for (DefaultTypedTuple defaultTypedTuple : set) {
hotWords.add(Objects.requireNonNull(defaultTypedTuple.getValue()).toString());