瀏覽代碼

修改redis的过期时间

chenweida 8 年之前
父節點
當前提交
2aaac2b1ae

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/extract/DBPageExtract.java

@ -91,7 +91,7 @@ public class DBPageExtract<T> {
     * @param pageSize
     * @return
     */
    private List<T> MultiThreadExtract(Class<T> clazz, String sql,String countSql, int pageSize)  {
    private   List<T> MultiThreadExtract(Class<T> clazz, String sql,String countSql, int pageSize)  {
        try{
            //得到数据的总数
            Integer dataCount=getCount(countSql);

+ 5 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -95,6 +95,10 @@ public class CurrentDayAllQuotaJob implements Job {
    String fv_jdbc_username;
    @Value("${fv.jdbc.password}")
    String fv_jdbc_password;
    @Value("${redis.quota.current.expire}")
    Integer currentExpire=2;
    @Override
    public void execute(JobExecutionContext context)
            throws JobExecutionException {
@ -167,7 +171,7 @@ public class CurrentDayAllQuotaJob implements Job {
        quartzJobLog.setJobEndTime(new Date());
        quartzJobLogDao.save(quartzJobLog);
        for (String key :RedisStorage.keys){
            redisTemplate.expire(key, 1, TimeUnit.HOURS);//1小时过期
            redisTemplate.expire(key, currentExpire, TimeUnit.HOURS);//2小时过期
        }
        RedisStorage.keys.clear();//清空Key

+ 4 - 0
patient-co-statistics/src/main/resources/application.yml

@ -53,6 +53,10 @@ spring:
      max-wait: -1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
      min-idle: 1 # Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
redis:
  quota:
    current:
      expire: 2 #实时统计redis 的过期时间 默认是2小时
multipart:
  max-file-size: 100MB