Browse Source

增加SWConsts.debug,是否调试模式,调试模式缓存从数据库加载

4.0
郑根木 2 years ago
parent
commit
407397fa1e
5 changed files with 5 additions and 6 deletions
  1. +0
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmConfigBean.java
  2. +0
    -1
      smtweb-framework/bpm/src/main/resources/config/application.yaml
  3. +1
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/CoreAutoConfiguration.java
  4. +2
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java
  5. +2
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java

+ 0
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/BpmConfigBean.java View File

@@ -8,8 +8,6 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "smtweb.bpm") @ConfigurationProperties(prefix = "smtweb.bpm")
@Data @Data
public class BpmConfigBean { public class BpmConfigBean {
// 是否debug模式
private boolean debug;
private String codeJavaPath; private String codeJavaPath;
private int mode; private int mode;
} }

+ 0
- 1
smtweb-framework/bpm/src/main/resources/config/application.yaml View File

@@ -20,7 +20,6 @@ smtweb:
#ftp 密码 #ftp 密码
attach-ftp-pwd: Bjjt@2021 attach-ftp-pwd: Bjjt@2021
bpm: bpm:
debug: true
# 有.idea或pom.xml文件的目录 # 有.idea或pom.xml文件的目录
code-java-path: 'd:/work/smtweb2/smtweb-framework' code-java-path: 'd:/work/smtweb2/smtweb-framework'
# 读取模式 1-读取pom.xml,要求module名同目录 2-读取.idea/modules.xml # 读取模式 1-读取pom.xml,要求module名同目录 2-读取.idea/modules.xml


+ 1
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/CoreAutoConfiguration.java View File

@@ -20,7 +20,7 @@ public class CoreAutoConfiguration {
*/ */
@Value("${smtweb.machine-id}") @Value("${smtweb.machine-id}")
private int machineId; private int machineId;
@Bean @Bean
public IdGenerator idGenerator() { public IdGenerator idGenerator() {
return new IdGenerator(machineId); return new IdGenerator(machineId);


+ 2
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/AbstractCache.java View File

@@ -1,5 +1,6 @@
package cc.smtweb.framework.core.cache; package cc.smtweb.framework.core.cache;


import cc.smtweb.framework.core.CoreAutoConfiguration;
import cc.smtweb.framework.core.annotation.SwCache; import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent; import cc.smtweb.framework.core.cache.redis.RedisBroadcastEvent;
import cc.smtweb.framework.core.cache.redis.RedisManager; import cc.smtweb.framework.core.cache.redis.RedisManager;
@@ -27,7 +28,6 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
public abstract class AbstractCache<T extends Serializable> implements ISwCache<String, T> { public abstract class AbstractCache<T extends Serializable> implements ISwCache<String, T> {

protected final static int LS_NONE = 0; protected final static int LS_NONE = 0;
protected final static int LS_LOADING = 1; protected final static int LS_LOADING = 1;
protected final static int LS_LOADED = 2; protected final static int LS_LOADED = 2;
@@ -110,7 +110,7 @@ public abstract class AbstractCache<T extends Serializable> implements ISwCache<
* 否则,非lazy,从数据库加载,并更新redis * 否则,非lazy,从数据库加载,并更新redis
*/ */
protected void init() { protected void init() {
if (RedisManager.getInstance().exists(getIdent())) {
if (!SwConsts.SYS_DEBUG && RedisManager.getInstance().exists(getIdent())) {
log.info("从redis同步缓存!(" + getTitle() + ")"); log.info("从redis同步缓存!(" + getTitle() + ")");
//从缓存服务器下载到本地 //从缓存服务器下载到本地
syncCache(); syncCache();


+ 2
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java View File

@@ -4,6 +4,8 @@ package cc.smtweb.framework.core.common;
* Created by Akmm at 2022/3/23 9:46 * Created by Akmm at 2022/3/23 9:46
*/ */
public interface SwConsts { public interface SwConsts {
//开发调试模式
boolean SYS_DEBUG = true;
int DEFAULT_ORDER = 1; int DEFAULT_ORDER = 1;
//缓存中:树节点按parent的key //缓存中:树节点按parent的key
String KEY_PARENT_ID = "pr"; String KEY_PARENT_ID = "pr";


Loading…
Cancel
Save