Commit 8a68bae0bb02127cc62c07bf8727af4b88df0981

Authored by 648540858
1 parent cb897aae

修复redis数据写入时超时时间设置错误的问题

src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
... ... @@ -27,6 +27,7 @@ import org.springframework.data.redis.core.RedisTemplate;
27 27 import org.springframework.data.redis.core.StringRedisTemplate;
28 28 import org.springframework.stereotype.Component;
29 29  
  30 +import java.time.Duration;
30 31 import java.util.*;
31 32  
32 33 @SuppressWarnings("rawtypes")
... ... @@ -189,7 +190,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
189 190 redisTemplate.opsForValue().set(key, stream);
190 191 }else {
191 192 logger.debug("添加下载缓存==未完成下载=》{}",key);
192   - redisTemplate.opsForValue().set(key, stream, 60*60);
  193 + Duration duration = Duration.ofSeconds(60*60L);
  194 + redisTemplate.opsForValue().set(key, stream, duration);
193 195 }
194 196 return true;
195 197 }
... ... @@ -355,7 +357,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
355 357 @Override
356 358 public void updatePlatformRegisterInfo(String callId, PlatformRegisterInfo platformRegisterInfo) {
357 359 String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId;
358   - redisTemplate.opsForValue().set(key, platformRegisterInfo, 30);
  360 + Duration duration = Duration.ofSeconds(30L);
  361 + redisTemplate.opsForValue().set(key, platformRegisterInfo, duration);
359 362 }
360 363  
361 364  
... ... @@ -566,7 +569,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
566 569 @Override
567 570 public void updateWVPInfo(JSONObject jsonObject, int time) {
568 571 String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId();
569   - redisTemplate.opsForValue().set(key, jsonObject, time);
  572 + Duration duration = Duration.ofSeconds(time);
  573 + redisTemplate.opsForValue().set(key, jsonObject, duration);
570 574 }
571 575  
572 576 @Override
... ... @@ -698,7 +702,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
698 702 @Override
699 703 public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
700 704 String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId();
701   - redisTemplate.opsForValue().set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
  705 + Duration duration = Duration.ofSeconds(60L);
  706 + redisTemplate.opsForValue().set(key, gpsMsgInfo, duration); // 默认GPS消息保存1分钟
702 707 }
703 708  
704 709 @Override
... ...