提交 5163fd68 编写于 作者: 街头小贩's avatar 街头小贩 提交者: Gitee

为缓存方法添加条件

上级 ee271be6
......@@ -13,7 +13,7 @@ public class BoardConfigServiceImpl implements BoardConfigService{
@Autowired
private BoardConfigDao boardConfigDao;
@Cacheable(value="boardCache", key="'board_config_'+#boardId")
@Cacheable(value="boardCache", key="'board_config_'+#boardId", unless="#result==null")
@Override
public Optional<BoardConfig> getByBoardId(long boardId) { //[BC]B2
return boardConfigDao.findOneByBoard(boardId);
......
......@@ -13,7 +13,7 @@ public class TopicConfigServiceImpl implements TopicConfigService{
@Autowired
private TopicConfigDao topicConfigDao;
@Cacheable(value="topicCache", key="'topic_config_'+#topicId")
@Cacheable(value="topicCache", key="'topic_config_'+#topicId", unless="#result==null")
@Override
public Optional<TopicConfig> getByTopicId(long topicId) { //[TC]T2
return topicConfigDao.findOneByTopic(topicId);
......
......@@ -25,7 +25,7 @@ public class ForumScoreRoleServiceImpl implements ForumScoreRoleService{
return forumScoreRoleDao.findAllUsed();
}
@Cacheable(value = "memberCache", key="'score_'+#id")
@Cacheable(value = "memberCache", key="'score_'+#id", unless="#result==null")
@Override
public Optional<ForumScoreRole> get(int id) { //[MC]M4
if(id>0){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册