pert: 优化查看缓存数据和清空缓存

main
huangfeng 7 months ago
parent 553ac7ddac
commit e2fecd6d8d

@ -1,6 +1,5 @@
package com.xydl.cac.controller; package com.xydl.cac.controller;
import com.xydl.cac.iec.IecClient;
import com.xydl.cac.model.Response; import com.xydl.cac.model.Response;
import com.xydl.cac.model.StaticVariable; import com.xydl.cac.model.StaticVariable;
import com.xydl.cac.service.IcdFileConfigService; import com.xydl.cac.service.IcdFileConfigService;
@ -40,9 +39,28 @@ public class TestController extends BasicController {
webSocketServer.sendMessage(msg, warningId); webSocketServer.sendMessage(msg, warningId);
} }
@GetMapping("realTimeMap") @GetMapping("realTimeClientMap")
@ApiOperation("实时订阅Map") @ApiOperation("realTimeClientMap")
public Response<HashMap<Integer, IecClient>> realTimeMap() { public Response<HashMap> realTimeClientMap() {
return Response.success(StaticVariable.realTimeClientMap); return Response.success(StaticVariable.realTimeClientMap);
} }
@GetMapping("paramRelationMap")
@ApiOperation("paramRelationMap")
public Response<HashMap> paramRelationMap() {
return Response.success(StaticVariable.paramRelationMap);
}
@GetMapping("sensorLastDataMap")
@ApiOperation("sensorLastDataMap")
public Response<HashMap> sensorLastDataMap() {
return Response.success(StaticVariable.sensorLastDataMap);
}
@GetMapping("clearMap")
@ApiOperation("clearMap")
public void clearMap() {
StaticVariable.sensorLastDataMap.clear();
StaticVariable.paramRelationMap.clear();
}
} }

@ -17,17 +17,20 @@ public class CacheTask {
@Resource @Resource
WarnRuleService ruleService; WarnRuleService ruleService;
@Scheduled(cron = "0 0 1 * * ?")
@Scheduled(cron = "0 0 9 * * ?") private void clearCache1() {
private void clearCache() {
StaticVariable.unit_Cache.clear(); StaticVariable.unit_Cache.clear();
StaticVariable.modevType_Cache = null; StaticVariable.modevType_Cache = null;
StaticVariable.jg_Cache = null; StaticVariable.jg_Cache = null;
StaticVariable.zsb_Cache = null; StaticVariable.zsb_Cache = null;
StaticVariable.rule_Cache.clear(); StaticVariable.rule_Cache.clear();
StaticVariable.doneWarnMap.clear(); StaticVariable.paramRelationMap.clear();
} }
@Scheduled(cron = "0 30 9 * * ?")
private void clearCache9() {
StaticVariable.doneWarnMap.clear();
}
@Scheduled(initialDelay = 30 * 1000, fixedDelay = 60 * 1000) @Scheduled(initialDelay = 30 * 1000, fixedDelay = 60 * 1000)
private void refreshRule() { private void refreshRule() {

Loading…
Cancel
Save