wukai 2 месяцев назад
Родитель
Сommit
b5c6ac6252
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      jjt-biz/src/main/java/com/jjt/utils/IotService.java

+ 3 - 3
jjt-biz/src/main/java/com/jjt/utils/IotService.java

@@ -13,10 +13,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 /**
  * IotServiceImpl$
@@ -63,7 +63,7 @@ public class IotService {
      * @return token
      */
     public void setToken() {
-        redisCache.setCacheObject(CacheConstants.IOT_TOKEN, queryToken());
+        redisCache.setCacheObject(CacheConstants.IOT_TOKEN, queryToken(), 30, TimeUnit.MINUTES);
     }
 
     /**
@@ -77,7 +77,7 @@ public class IotService {
             return token;
         }
         token = queryToken();
-        redisCache.setCacheObject(CacheConstants.IOT_TOKEN, token);
+        redisCache.setCacheObject(CacheConstants.IOT_TOKEN, token, 30, TimeUnit.MINUTES);
         return token;
     }