This commit is contained in:
loujf
2022-10-14 16:54:59 +08:00
9 changed files with 2 additions and 99 deletions

View File

@@ -1,19 +0,0 @@
package org.nl.modules.cache;
import com.alicp.jetcache.Cache;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.CreateCache;
import lombok.Data;
@Data
public class BothCacheManager extends NlCacheManager {
/**
* 使用 @CreateCache 注解创建Cache实例;
* 未定义默认值的参数将使用yml中指定的全局配置;
* 缓存在 Local也可以配置成 both 开启两级缓存
*/
@CreateCache(expire = 5 * 60, cacheType = CacheType.BOTH, localLimit = 10)
private Cache<Object, Object> defaultCache;
@CreateCache(expire = 5 * 60, cacheType = CacheType.BOTH, localLimit = 10)
private Cache<Object, Object> systemCache;
}

View File

@@ -1,23 +0,0 @@
package org.nl.modules.cache;
import com.alicp.jetcache.anno.CacheConsts;
import com.alicp.jetcache.anno.CacheType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CacheConfig {
@Value("${jetcache.defaultCacheType}")
private String cacheType;
@Bean(name = "sysCacheManager")
public NlCacheManager sysCacheManager() {
CacheConsts.isUndefined(2);
if (CacheType.BOTH.name().equals(cacheType)) return new BothCacheManager();
if (CacheType.LOCAL.name().equals(cacheType)) return new LocalCacheManager();
if (CacheType.REMOTE.name().equals(cacheType)) return new RemoteCacheManager();
return new LocalCacheManager();
}
}

View File

@@ -1,19 +0,0 @@
package org.nl.modules.cache;
import com.alicp.jetcache.Cache;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.CreateCache;
import lombok.Data;
@Data
public class LocalCacheManager extends NlCacheManager {
/**
* 使用 @CreateCache 注解创建Cache实例;
* 未定义默认值的参数将使用yml中指定的全局配置;
* 缓存在 Local也可以配置成 both 开启两级缓存
*/
@CreateCache(expire = 5 * 60, cacheType = CacheType.LOCAL, localLimit = 10)
private Cache<Object, Object> defaultCache;
@CreateCache(expire = 5 * 60, cacheType = CacheType.LOCAL, localLimit = 10)
private Cache<Object, Object> systemCache;
}

View File

@@ -1,13 +0,0 @@
package org.nl.modules.cache;
import com.alicp.jetcache.Cache;
import lombok.Data;
@Data
public abstract class NlCacheManager {
private Cache<Object, Object> defaultCache;
private Cache<Object, Object> systemCache;
public void test(){
System.out.println(this.getClass().getName());
}
}

View File

@@ -1,24 +0,0 @@
package org.nl.modules.cache;
import com.alicp.jetcache.Cache;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.CreateCache;
import lombok.Data;
@Data
public class RemoteCacheManager extends NlCacheManager {
/**
* 使用 @CreateCache 注解创建Cache实例;
* 未定义默认值的参数将使用yml中指定的全局配置;
* 缓存在 Local也可以配置成 both 开启两级缓存
*/
@CreateCache(expire = 5 * 60, cacheType = CacheType.REMOTE, localLimit = 10)
private Cache<Object, Object> defaultCache;
@CreateCache(expire = 5 * 60, cacheType = CacheType.REMOTE, localLimit = 10)
private Cache<Object, Object> systemCache;
@Override
public void test() {
System.out.println(this.getClass().getName());
}
}

View File

@@ -129,8 +129,9 @@ public class ExecutionJob extends QuartzJobBean {
// EmailVo emailVo = taskAlarm(quartzJob, ThrowableUtil.getStackTrace(e));
// emailService.send(emailVo, emailService.find());
}
} finally {
log.info(QUARTZ_MARKER, logDto.toString());
} finally {
//quartzLogRepository.save(log);
}
}