mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-06 04:18:07 +00:00
update 优化 RedisUtils 重构过期方法
This commit is contained in:
@@ -5,10 +5,10 @@ import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import com.ruoyi.common.redis.utils.RedisUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Sa-Token持久层接口(使用框架自带RedisUtils实现 协议统一)
|
||||
@@ -38,7 +38,7 @@ public class PlusSaTokenDao implements SaTokenDao {
|
||||
if (timeout == SaTokenDao.NEVER_EXPIRE) {
|
||||
RedisUtils.setCacheObject(key, value);
|
||||
} else {
|
||||
RedisUtils.setCacheObject(key, value, timeout, TimeUnit.SECONDS);
|
||||
RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class PlusSaTokenDao implements SaTokenDao {
|
||||
}
|
||||
return;
|
||||
}
|
||||
RedisUtils.expire(key, timeout, TimeUnit.SECONDS);
|
||||
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PlusSaTokenDao implements SaTokenDao {
|
||||
if (timeout == SaTokenDao.NEVER_EXPIRE) {
|
||||
RedisUtils.setCacheObject(key, object);
|
||||
} else {
|
||||
RedisUtils.setCacheObject(key, object, timeout, TimeUnit.SECONDS);
|
||||
RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class PlusSaTokenDao implements SaTokenDao {
|
||||
}
|
||||
return;
|
||||
}
|
||||
RedisUtils.expire(key, timeout, TimeUnit.SECONDS);
|
||||
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user