添加redis配置,将id缓存迁移由缓存移动到redis

This commit is contained in:
hzj
2024-11-04 16:25:43 +08:00
parent 401d2a4e97
commit 00beb8efa8
9 changed files with 496 additions and 36 deletions

View File

@@ -3,7 +3,9 @@ package com.njcn.influx.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.influx.bo.po.JobDetailInfluxDB;
import com.njcn.influx.config.IdMappingCache;
import com.njcn.influx.service.JobDetailInfluxDBService;
import com.njcn.oracle.bo.param.DataAsynParam;
import com.njcn.oracle.bo.param.JobQueryParam;
import com.njcn.oracle.bo.po.JobDetail;
import com.njcn.oracle.service.JobDetailService;
@@ -13,10 +15,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* Description:
@@ -34,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
public class JobDetailInfluxDBController {
private final JobDetailInfluxDBService jobDetailInfluxDBService;
private final IdMappingCache idMappingCache;
@PostMapping("/jobQuery")
@ApiOperation("任务查询")
@ApiImplicitParam(name = "jobQueryParam", value = "任务查询参数", required = true)
@@ -48,4 +48,12 @@ public class JobDetailInfluxDBController {
boolean b = jobDetailInfluxDBService.jobRemove(jobDetail);
return b;
}
@GetMapping("/refreshIdCache")
@ApiOperation("刷新缓存")
public Boolean refreshIdCache() {
DataAsynParam dataAsynParam = new DataAsynParam();
idMappingCache.init();
return true;// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "数据同步");
}
}

View File

@@ -1,4 +1,4 @@
#文件位置配置
business:
#分片次数一定为24的约数1 2 3 4 6 8 12 24
slice: 4
@@ -87,6 +87,19 @@ spring:
username: root
password: njcnpqs
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
database: 15
host: 192.168.1.22
port: 16379
password: njcnpqs
timeout: 5000
lettuce:
pool:
max-active: 8
max-wait: -1
max-idle: 8
min-idle: 0
#不做限制的参数配置
#mybatis配置信息
mybatis-plus:
#别名扫描