|
|
@ -45,12 +45,9 @@ public class PlusSaTokenDao implements SaTokenDao {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void update(String key, String value) {
|
|
|
|
public void update(String key, String value) {
|
|
|
|
long expire = getTimeout(key);
|
|
|
|
if (RedisUtils.hasKey(key)) {
|
|
|
|
// -2 = 无此键
|
|
|
|
RedisUtils.setCacheObject(key, value, true);
|
|
|
|
if (expire == NOT_VALUE_EXPIRE) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.set(key, value, expire);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -75,17 +72,6 @@ public class PlusSaTokenDao implements SaTokenDao {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateTimeout(String key, long timeout) {
|
|
|
|
public void updateTimeout(String key, long timeout) {
|
|
|
|
// 判断是否想要设置为永久
|
|
|
|
|
|
|
|
if (timeout == NEVER_EXPIRE) {
|
|
|
|
|
|
|
|
long expire = getTimeout(key);
|
|
|
|
|
|
|
|
if (expire == NEVER_EXPIRE) {
|
|
|
|
|
|
|
|
// 如果其已经被设置为永久,则不作任何处理
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果尚未被设置为永久,那么再次set一次
|
|
|
|
|
|
|
|
this.set(key, this.get(key), timeout);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
|
|
|
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -119,12 +105,9 @@ public class PlusSaTokenDao implements SaTokenDao {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateObject(String key, Object object) {
|
|
|
|
public void updateObject(String key, Object object) {
|
|
|
|
long expire = getObjectTimeout(key);
|
|
|
|
if (RedisUtils.hasKey(key)) {
|
|
|
|
// -2 = 无此键
|
|
|
|
RedisUtils.setCacheObject(key, object, true);
|
|
|
|
if (expire == NOT_VALUE_EXPIRE) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setObject(key, object, expire);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -149,17 +132,6 @@ public class PlusSaTokenDao implements SaTokenDao {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateObjectTimeout(String key, long timeout) {
|
|
|
|
public void updateObjectTimeout(String key, long timeout) {
|
|
|
|
// 判断是否想要设置为永久
|
|
|
|
|
|
|
|
if (timeout == NEVER_EXPIRE) {
|
|
|
|
|
|
|
|
long expire = getObjectTimeout(key);
|
|
|
|
|
|
|
|
if (expire == NEVER_EXPIRE) {
|
|
|
|
|
|
|
|
// 如果其已经被设置为永久,则不作任何处理
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果尚未被设置为永久,那么再次set一次
|
|
|
|
|
|
|
|
this.setObject(key, this.getObject(key), timeout);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
|
|
|
RedisUtils.expire(key, Duration.ofSeconds(timeout));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|