部分后台任务获取Topic列表时不走缓存

This commit is contained in:
zengqiao
2021-04-22 16:06:37 +08:00
parent 59df5b24fe
commit d6559be3fc
5 changed files with 19 additions and 2 deletions

View File

@@ -15,6 +15,8 @@ public interface TopicDao {
TopicDO getByTopicName(Long clusterId, String topicName);
List<TopicDO> getByClusterIdFromCache(Long clusterId);
List<TopicDO> getByClusterId(Long clusterId);
List<TopicDO> getByAppId(String appId);

View File

@@ -62,11 +62,16 @@ public class TopicDaoImpl implements TopicDao {
}
@Override
public List<TopicDO> getByClusterId(Long clusterId) {
public List<TopicDO> getByClusterIdFromCache(Long clusterId) {
updateTopicCache();
return new ArrayList<>(TOPIC_MAP.getOrDefault(clusterId, Collections.emptyMap()).values());
}
@Override
public List<TopicDO> getByClusterId(Long clusterId) {
return sqlSession.selectList("TopicDao.getByClusterId", clusterId);
}
@Override
public List<TopicDO> getByAppId(String appId) {
return sqlSession.selectList("TopicDao.getByAppId", appId);