mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-05 13:08:48 +08:00
部分后台任务获取Topic列表时不走缓存
This commit is contained in:
@@ -22,6 +22,8 @@ import java.util.Map;
|
|||||||
public interface TopicManagerService {
|
public interface TopicManagerService {
|
||||||
List<TopicDO> listAll();
|
List<TopicDO> listAll();
|
||||||
|
|
||||||
|
List<TopicDO> getByClusterIdFromCache(Long clusterId);
|
||||||
|
|
||||||
List<TopicDO> getByClusterId(Long clusterId);
|
List<TopicDO> getByClusterId(Long clusterId);
|
||||||
|
|
||||||
TopicDO getByTopicName(Long clusterId, String topicName);
|
TopicDO getByTopicName(Long clusterId, String topicName);
|
||||||
|
|||||||
@@ -95,6 +95,14 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TopicDO> getByClusterIdFromCache(Long clusterId) {
|
||||||
|
if (clusterId == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return topicDao.getByClusterIdFromCache(clusterId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopicDO> getByClusterId(Long clusterId) {
|
public List<TopicDO> getByClusterId(Long clusterId) {
|
||||||
if (clusterId == null) {
|
if (clusterId == null) {
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ public class TopicServiceImpl implements TopicService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TopicDO> topicDOList = topicManagerService.getByClusterId(clusterId);
|
List<TopicDO> topicDOList = topicManagerService.getByClusterIdFromCache(clusterId);
|
||||||
if (ValidateUtils.isNull(topicDOList)) {
|
if (ValidateUtils.isNull(topicDOList)) {
|
||||||
topicDOList = new ArrayList<>();
|
topicDOList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ public interface TopicDao {
|
|||||||
|
|
||||||
TopicDO getByTopicName(Long clusterId, String topicName);
|
TopicDO getByTopicName(Long clusterId, String topicName);
|
||||||
|
|
||||||
|
List<TopicDO> getByClusterIdFromCache(Long clusterId);
|
||||||
|
|
||||||
List<TopicDO> getByClusterId(Long clusterId);
|
List<TopicDO> getByClusterId(Long clusterId);
|
||||||
|
|
||||||
List<TopicDO> getByAppId(String appId);
|
List<TopicDO> getByAppId(String appId);
|
||||||
|
|||||||
@@ -62,11 +62,16 @@ public class TopicDaoImpl implements TopicDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopicDO> getByClusterId(Long clusterId) {
|
public List<TopicDO> getByClusterIdFromCache(Long clusterId) {
|
||||||
updateTopicCache();
|
updateTopicCache();
|
||||||
return new ArrayList<>(TOPIC_MAP.getOrDefault(clusterId, Collections.emptyMap()).values());
|
return new ArrayList<>(TOPIC_MAP.getOrDefault(clusterId, Collections.emptyMap()).values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TopicDO> getByClusterId(Long clusterId) {
|
||||||
|
return sqlSession.selectList("TopicDao.getByClusterId", clusterId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopicDO> getByAppId(String appId) {
|
public List<TopicDO> getByAppId(String appId) {
|
||||||
return sqlSession.selectList("TopicDao.getByAppId", appId);
|
return sqlSession.selectList("TopicDao.getByAppId", appId);
|
||||||
|
|||||||
Reference in New Issue
Block a user