From 5cf45e866329428864bc1c3ec1a0f67ba282fc8a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 07 三月 2023 18:20:55 +0800
Subject: [PATCH] update springboot 3.0.2 => 3.0.4 update easyexcel 3.2.0 => 3.2.1 update hutool 5.8.11 => 5.8.14 update redisson 3.19.2 => 3.20.0 update lombok 1.18.24 => 1.18.26 update maven-compiler-plugin 3.10.1 => 3.11.0 update maven-surefire-plugin 3.0.0-M7 => 3.0.0-M9

---
 ruoyi-common/ruoyi-common-tenant/src/main/java/com/ruoyi/common/tenant/core/TenantSaTokenDao.java |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/com/ruoyi/common/tenant/core/TenantSaTokenDao.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/com/ruoyi/common/tenant/core/TenantSaTokenDao.java
index db9c025..a84bbbd 100644
--- a/ruoyi-common/ruoyi-common-tenant/src/main/java/com/ruoyi/common/tenant/core/TenantSaTokenDao.java
+++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/com/ruoyi/common/tenant/core/TenantSaTokenDao.java
@@ -1,8 +1,10 @@
 package com.ruoyi.common.tenant.core;
 
 import com.ruoyi.common.core.constant.GlobalConstants;
+import com.ruoyi.common.redis.utils.RedisUtils;
 import com.ruoyi.common.satoken.core.dao.PlusSaTokenDao;
 
+import java.time.Duration;
 import java.util.List;
 
 /**
@@ -27,7 +29,12 @@
      */
     @Override
     public void update(String key, String value) {
-        super.update(GlobalConstants.GLOBAL_REDIS_KEY + key, value);
+        long expire = getTimeout(key);
+        // -2 = 鏃犳閿�
+        if (expire == NOT_VALUE_EXPIRE) {
+            return;
+        }
+        this.set(key, value, expire);
     }
 
     /**
@@ -51,7 +58,18 @@
      */
     @Override
     public void updateTimeout(String key, long timeout) {
-        super.updateTimeout(GlobalConstants.GLOBAL_REDIS_KEY + key, timeout);
+        // 鍒ゆ柇鏄惁鎯宠璁剧疆涓烘案涔�
+        if (timeout == NEVER_EXPIRE) {
+            long expire = getTimeout(key);
+            if (expire == NEVER_EXPIRE) {
+                // 濡傛灉鍏跺凡缁忚璁剧疆涓烘案涔咃紝鍒欎笉浣滀换浣曞鐞�
+            } else {
+                // 濡傛灉灏氭湭琚缃负姘镐箙锛岄偅涔堝啀娆et涓�娆�
+                this.set(key, this.get(key), timeout);
+            }
+            return;
+        }
+        RedisUtils.expire(GlobalConstants.GLOBAL_REDIS_KEY + key, Duration.ofSeconds(timeout));
     }
 
 
@@ -76,7 +94,12 @@
      */
     @Override
     public void updateObject(String key, Object object) {
-        super.updateObject(GlobalConstants.GLOBAL_REDIS_KEY + key, object);
+        long expire = getObjectTimeout(key);
+        // -2 = 鏃犳閿�
+        if (expire == NOT_VALUE_EXPIRE) {
+            return;
+        }
+        this.setObject(key, object, expire);
     }
 
     /**
@@ -100,7 +123,18 @@
      */
     @Override
     public void updateObjectTimeout(String key, long timeout) {
-        super.updateObjectTimeout(GlobalConstants.GLOBAL_REDIS_KEY + key, timeout);
+        // 鍒ゆ柇鏄惁鎯宠璁剧疆涓烘案涔�
+        if (timeout == NEVER_EXPIRE) {
+            long expire = getObjectTimeout(key);
+            if (expire == NEVER_EXPIRE) {
+                // 濡傛灉鍏跺凡缁忚璁剧疆涓烘案涔咃紝鍒欎笉浣滀换浣曞鐞�
+            } else {
+                // 濡傛灉灏氭湭琚缃负姘镐箙锛岄偅涔堝啀娆et涓�娆�
+                this.setObject(key, this.getObject(key), timeout);
+            }
+            return;
+        }
+        RedisUtils.expire(GlobalConstants.GLOBAL_REDIS_KEY + key, Duration.ofSeconds(timeout));
     }
 
 

--
Gitblit v1.9.3