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

为缓存方法添加条件

上级 08f2d396
......@@ -21,7 +21,7 @@ public class BoardConfigServiceImpl implements BoardConfigService{
private BoardConfigDao boardConfigDao;
private final static Logger logger = LoggerFactory.getLogger(BoardConfigServiceImpl.class);
@Cacheable(value="boardCache", key="'board_config_'+#boardId")
@Cacheable(value="boardCache", key="'board_config_'+#boardId", unless="#result == null")
@Override
public Optional<BoardConfig> getByBoardId(long boardId) {
return boardConfigDao.findOneByBoard(boardId);
......
......@@ -21,7 +21,7 @@ public class TopicConfigServiceImpl implements TopicConfigService{
private TopicConfigDao topicConfigDao;
private final static Logger logger = LoggerFactory.getLogger(TopicConfigServiceImpl.class);
@Cacheable(value="topicCache", key="'topic_config_'+#topicId")
@Cacheable(value="topicCache", key="'topic_config_'+#topicId", unless="#result == null")
@Override
public Optional<TopicConfig> getByTopicId(long topicId) {
return topicConfigDao.findOneByTopic(topicId);
......
......@@ -49,7 +49,7 @@ public class ForumScoreRoleServiceImpl implements ForumScoreRoleService{
return Optional.empty();
}
@Cacheable(value = "memberCache", key="'score_'+#id")
@Cacheable(value = "memberCache", key="'score_'+#id", unless="#result == null")
@Override
public Optional<ForumScoreRole> get(int id) {
if (id > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册