parent
3469875469
commit
6fe5f9d07a
|
@ -26,11 +26,11 @@ public abstract class CacheAbs<K, V extends List<?>> implements Cache<K> {
|
|||
// this.redisService = redisService;
|
||||
// }
|
||||
|
||||
@Autowired
|
||||
public CacheAbs(RedisService redisService) {
|
||||
// if (redisService==null) redisService = new RedisService();
|
||||
this.redisService = redisService;
|
||||
}
|
||||
// @Autowired
|
||||
// public CacheAbs(RedisService redisService) {
|
||||
//// if (redisService==null) redisService = new RedisService();
|
||||
// this.redisService = redisService;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据key获取值
|
||||
|
|
|
@ -17,9 +17,9 @@ import java.util.List;
|
|||
public class AssetCache extends CacheAbs<String, List<BasicConfigInfo>> {
|
||||
|
||||
|
||||
public AssetCache(RedisService redisService) {
|
||||
super(redisService);
|
||||
}
|
||||
// public AssetCache(RedisService redisService) {
|
||||
// super(redisService);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String preKey() {
|
||||
|
|
|
@ -25,11 +25,14 @@ public class EtlApplicationRunner implements ApplicationRunner {
|
|||
@Autowired
|
||||
private BasicConfigInfoService basicConfigInfoService;
|
||||
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
private AssetCache assetCache ;
|
||||
|
||||
|
||||
AssetCache assetCache = new AssetCache(redisService);
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
List<BasicConfigInfo> basicConfigInfos = basicConfigInfoService.selectBasicConfigInfoList(new BasicConfigInfo() {{
|
||||
|
@ -40,11 +43,11 @@ public class EtlApplicationRunner implements ApplicationRunner {
|
|||
|
||||
@Scheduled(zone = "0 0/10 * * * ? *")
|
||||
public void delay(){
|
||||
if (!redisService.hasKey(assetCache.preKey()+"basic")) try {
|
||||
throw new ServletException("过期了");
|
||||
} catch (ServletException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
redisService.expire(assetCache.preKey()+"basic",10, TimeUnit.MINUTES);
|
||||
// if (!redisService.hasKey(assetCache.preKey()+"basic")) try {
|
||||
// throw new ServletException("过期了");
|
||||
// } catch (ServletException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// redisService.expire(assetCache.preKey()+"basic",10, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue