fix 修复 satoken dao层获取timeout为秒导致丢失毫秒进度问题(临时修复 等satoken官方解决)

This commit is contained in:
疯狂的狮子Li
2025-01-13 13:37:06 +08:00
parent 6fde504ed9
commit c8f49c680f

View File

@@ -51,7 +51,11 @@ public class PlusSaTokenDao implements SaTokenDao {
if (timeout == NEVER_EXPIRE) {
RedisUtils.setCacheObject(key, value);
} else {
RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout));
if (RedisUtils.hasKey(key)) {
RedisUtils.setCacheObject(key, value, true);
} else {
RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout));
}
}
CAFFEINE.invalidate(key);
}
@@ -114,7 +118,11 @@ public class PlusSaTokenDao implements SaTokenDao {
if (timeout == NEVER_EXPIRE) {
RedisUtils.setCacheObject(key, object);
} else {
RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout));
if (RedisUtils.hasKey(key)) {
RedisUtils.setCacheObject(key, object, true);
} else {
RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout));
}
}
CAFFEINE.invalidate(key);
}