diff --git a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java index fe37a82..03aa41d 100644 --- a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java +++ b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java @@ -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 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 set=(Set) 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; }