This commit is contained in:
click33 2023-04-14 14:37:30 +08:00
commit 06b0b984dd
6 changed files with 35 additions and 178 deletions

View File

@ -22,10 +22,11 @@
<module>sa-token-core</module>
<module>sa-token-starter</module>
<module>sa-token-plugin</module>
<!-- <module>sa-token-test</module> -->
<!-- <module>sa-token-demo/sa-token-demo-solon</module> -->
<!-- <module>sa-token-demo/sa-token-demo-sso-server-solon</module> -->
</modules>
<module>sa-token-demo/sa-token-demo-sso-server-solon</module>
<module>sa-token-demo/sa-token-demo-sso1-client-solon</module>
<module>sa-token-demo/sa-token-demo-sso2-client-solon</module>
<module>sa-token-demo/sa-token-demo-sso3-client-solon</module>
</modules>
<!-- 开源协议 apache 2.0 -->
<licenses>

View File

@ -24,8 +24,8 @@
<jakarta-servlet-api.version>6.0.0</jakarta-servlet-api.version>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<solon.version>2.2.3</solon.version>
<noear-redisx.version>1.4.5</noear-redisx.version>
<noear-snack3.version>3.2.54</noear-snack3.version>
<noear-redisx.version>1.4.7</noear-redisx.version>
<noear-snack3.version>3.2.65</noear-snack3.version>
<jfinal.version>4.9.17</jfinal.version>
<jboot.version>3.14.4</jboot.version>
<commons-pool2.version>2.5.0</commons-pool2.version>

View File

@ -40,13 +40,7 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void set(String key, String value, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) SaTokenDao.NEVER_EXPIRE);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) timeout);
}
}
@ -57,10 +51,6 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
@Override
public void update(String key, String value) {
long expire = getTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.set(key, value, expire);
}
@ -85,18 +75,9 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void updateTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.set(key, this.get(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}
@ -113,13 +94,7 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void setObject(String key, Object object, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.storeAndSerialize(key, object);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.storeAndSerialize(key, object, (int) timeout);
}
}
@ -130,10 +105,6 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
@Override
public void updateObject(String key, Object object) {
long expire = getObjectTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.setObject(key, object, expire);
}
@ -158,18 +129,9 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void updateObjectTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getObjectTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.setObject(key, this.getObject(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}

View File

@ -56,13 +56,7 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void set(String key, String value, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) SaTokenDao.NEVER_EXPIRE);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) timeout);
}
}
@ -73,10 +67,6 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
@Override
public void update(String key, String value) {
long expire = getTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.set(key, value, expire);
}
@ -101,18 +91,9 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void updateTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.set(key, this.get(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}
@ -129,12 +110,10 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void setObject(String key, Object object, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
String value = ONode.serialize(object);
set(key, value, timeout);
}
String value = ONode.serialize(object);
set(key, value, timeout);
}
/**
@ -143,10 +122,6 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
@Override
public void updateObject(String key, Object object) {
long expire = getObjectTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.setObject(key, object, expire);
}
@ -171,18 +146,9 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void updateObjectTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getObjectTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.setObject(key, this.getObject(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}

View File

@ -41,13 +41,7 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void set(String key, String value, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) SaTokenDao.NEVER_EXPIRE);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) timeout);
}
}
@ -58,10 +52,6 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
@Override
public void update(String key, String value) {
long expire = getTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.set(key, value, expire);
}
@ -86,18 +76,9 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void updateTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.set(key, this.get(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}
@ -114,13 +95,7 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void setObject(String key, Object object, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.storeAndSerialize(key, object);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.storeAndSerialize(key, object, (int) timeout);
}
}
@ -131,10 +106,6 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
@Override
public void updateObject(String key, Object object) {
long expire = getObjectTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.setObject(key, object, expire);
}
@ -159,18 +130,9 @@ public class SaTokenDaoOfRedisBase64 implements SaTokenDao {
*/
@Override
public void updateObjectTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getObjectTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.setObject(key, this.getObject(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}

View File

@ -57,13 +57,7 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void set(String key, String value, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
// 判断是否为永不过期
if (timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) SaTokenDao.NEVER_EXPIRE);
} else {
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
redisBucket.store(key, value, (int) timeout);
}
}
@ -74,10 +68,6 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
@Override
public void update(String key, String value) {
long expire = getTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.set(key, value, expire);
}
@ -102,18 +92,9 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void updateTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.set(key, this.get(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}
@ -130,12 +111,10 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void setObject(String key, Object object, long timeout) {
if (timeout == 0 || timeout <= SaTokenDao.NOT_VALUE_EXPIRE) {
return;
if (timeout > 0 || timeout == SaTokenDao.NEVER_EXPIRE) {
String value = ONode.serialize(object);
set(key, value, timeout);
}
String value = ONode.serialize(object);
set(key, value, timeout);
}
/**
@ -144,10 +123,6 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
@Override
public void updateObject(String key, Object object) {
long expire = getObjectTimeout(key);
// -2 = 无此键
if (expire == SaTokenDao.NOT_VALUE_EXPIRE) {
return;
}
this.setObject(key, object, expire);
}
@ -172,18 +147,9 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
*/
@Override
public void updateObjectTimeout(String key, long timeout) {
// 判断是否想要设置为永久
if (timeout == SaTokenDao.NEVER_EXPIRE) {
long expire = getObjectTimeout(key);
if (expire == SaTokenDao.NEVER_EXPIRE) {
// 如果其已经被设置为永久则不作任何处理
} else {
// 如果尚未被设置为永久那么再次set一次
this.setObject(key, this.getObject(key), timeout);
}
return;
if (redisBucket.exists(key)) {
redisBucket.delay(key, (int) timeout);
}
redisBucket.delay(key, (int) timeout);
}