提交 b00d779f authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 仪表板有过滤条件时 不使用缓存

上级 f098f651
...@@ -222,10 +222,17 @@ public class ChartViewService { ...@@ -222,10 +222,17 @@ public class ChartViewService {
// String key = "provider_sql_"+datasourceRequest.getDatasource().getId() + "_" + datasourceRequest.getTable() + "_" +datasourceRequest.getQuery(); // String key = "provider_sql_"+datasourceRequest.getDatasource().getId() + "_" + datasourceRequest.getTable() + "_" +datasourceRequest.getQuery();
// 定时抽取使用缓存 // 定时抽取使用缓存
Object cache; Object cache;
if ((cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, id)) == null) { // 仪表板有参数不实用缓存
if (CollectionUtils.isNotEmpty(requestList.getFilter())) {
data = datasourceProvider.getData(datasourceRequest);
}
// 仪表板无参数 且 未缓存过该视图 则查询后缓存
else if ((cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, id)) == null) {
data = datasourceProvider.getData(datasourceRequest); data = datasourceProvider.getData(datasourceRequest);
CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, id, data, null, null); CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, id, data, null, null);
}else { }
// 仪表板有缓存 使用缓存
else {
data = (List<String[]>) cache; data = (List<String[]>) cache;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论