fix: set redis expire for journal list

main
wangqing 12 months ago
parent c3352ac700
commit ae20662de9

@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.luoo.music.dao.CommentDao;
@ -111,7 +112,7 @@ public class JournalController {
if(null==journalRespDTOs) {
List<Journal> pageList = journalService.queryPage(queryReq);
journalRespDTOs = pageList.stream().map(journal -> JournalMapper.getJournalRespDTO(journal, journalCollectSet,mongoTemplate,redisTemplate,commentDao)).collect(Collectors.toList());
redisTemplate.opsForValue().set(redisPageJournalResponseDtoKey,journalRespDTOs);
redisTemplate.opsForValue().set(redisPageJournalResponseDtoKey,journalRespDTOs,6, TimeUnit.HOURS);
}
return journalRespDTOs;
}
@ -119,7 +120,7 @@ public class JournalController {
Set<String> set=(Set<String>) redisTemplate.opsForValue().get(Constants.REDIS_KEY_USER_COLLECT_JOURNAL+userId);
if(null==set) {
set=userCollectInfoService.getCollectSet(userId, CollectTypeEnum.JOURNAL);
redisTemplate.opsForValue().set(Constants.REDIS_KEY_USER_COLLECT_JOURNAL+userId,set);
redisTemplate.opsForValue().set(Constants.REDIS_KEY_USER_COLLECT_JOURNAL+userId,set,6,TimeUnit.HOURS);
}
return set;
}

Loading…
Cancel
Save