From 513a3f3ed103ec468d891ccad36fc2c735b567d5 Mon Sep 17 00:00:00 2001 From: DaleLee <1658850308@qq.com> Date: Sat, 9 Nov 2024 19:18:14 +0800 Subject: [PATCH] =?UTF-8?q?feature=20#IAY66T=20=E5=A2=9E=E5=8A=A0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=AE=B9=E9=87=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteflow/property/LiteflowConfig.java | 16 ++++++++++++++++ .../liteflow/springboot/LiteflowProperty.java | 11 +++++++++++ .../LiteflowPropertyAutoConfiguration.java | 1 + ...additional-spring-configuration-metadata.json | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/property/LiteflowConfig.java b/liteflow-core/src/main/java/com/yomahub/liteflow/property/LiteflowConfig.java index 90ba42c5c..e351b257f 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/property/LiteflowConfig.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/property/LiteflowConfig.java @@ -127,6 +127,9 @@ public class LiteflowConfig { //是否启用节点实例ID private Boolean enableNodeInstanceId; + // 规则缓存容量 + private Integer ruleCacheCapacity; + public Boolean getEnableMonitorFile() { return enableMonitorFile; } @@ -524,4 +527,17 @@ public class LiteflowConfig { public void setEnableNodeInstanceId(Boolean enableNodeInstanceId) { this.enableNodeInstanceId = enableNodeInstanceId; } + + + public Integer getRuleCacheCapacity() { + return ruleCacheCapacity; + } + + public void setRuleCacheCapacity(Integer ruleCacheCapacity) { + this.ruleCacheCapacity = ruleCacheCapacity; + } + + public boolean isRuleCacheEnabled() { + return ObjectUtil.isNotNull(ruleCacheCapacity) && ruleCacheCapacity > 0; + } } diff --git a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowProperty.java b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowProperty.java index 6dfd031fc..5e2d45095 100644 --- a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowProperty.java +++ b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowProperty.java @@ -104,6 +104,9 @@ public class LiteflowProperty { //是否启用节点实例ID private boolean enableNodeInstanceId; + // 规则缓存容量 + private Integer ruleCacheCapacity; + public boolean isEnableMonitorFile() { return enableMonitorFile; } @@ -347,4 +350,12 @@ public class LiteflowProperty { public void setEnableNodeInstanceId(boolean enableNodeInstanceId) { this.enableNodeInstanceId = enableNodeInstanceId; } + + public Integer getRuleCacheCapacity() { + return ruleCacheCapacity; + } + + public void setRuleCacheCapacity(Integer ruleCacheCapacity) { + this.ruleCacheCapacity = ruleCacheCapacity; + } } diff --git a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowPropertyAutoConfiguration.java b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowPropertyAutoConfiguration.java index 7a4124f1f..5ea57f1f9 100644 --- a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowPropertyAutoConfiguration.java +++ b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowPropertyAutoConfiguration.java @@ -55,6 +55,7 @@ public class LiteflowPropertyAutoConfiguration { liteflowConfig.setPeriod(liteflowMonitorProperty.getPeriod()); liteflowConfig.setScriptSetting(property.getScriptSetting()); liteflowConfig.setEnableNodeInstanceId(property.isEnableNodeInstanceId()); + liteflowConfig.setRuleCacheCapacity(property.getRuleCacheCapacity()); return liteflowConfig; } diff --git a/liteflow-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/liteflow-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 9d293d9cf..6875189ff 100644 --- a/liteflow-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/liteflow-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -227,6 +227,12 @@ "description": "enable node instance id", "sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty", "defaultValue": false + }, + { + "name": "liteflow.liteflow.rule-cache-capacity", + "type": "java.lang.Integer", + "description": "Set the rules cache capacity.", + "sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty" } ] } \ No newline at end of file