Skip to content

Commit

Permalink
优化 solon 相关的 SaTokenDaoOfRedisJson 序列化处理
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed May 11, 2024
1 parent 4be4ee5 commit 1a62c39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.dao.SaTokenDaoOfRedis;
import cn.dev33.satoken.dao.SaTokenDaoOfRedisJson;
import cn.dev33.satoken.solon.integration.SaTokenInterceptor;
import com.pj.util.AjaxJson;
import org.noear.solon.annotation.Bean;
Expand Down Expand Up @@ -60,7 +61,7 @@ public SaTokenInterceptor tokenPathFilter() {

//如果需要 redis dao,加这段代表
@Bean
public SaTokenDao saTokenDaoInit(@Inject("${sa-token-dao.redis}") SaTokenDaoOfRedis saTokenDao) {
public SaTokenDao saTokenDaoInit(@Inject("${sa-token-dao.redis}") SaTokenDaoOfRedisJson saTokenDao) {
return saTokenDao;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ public SaTokenDaoOfRedisJson(RedisClient redisClient) {

}

@Override
public SaSession getSession(String sessionId) {
Object obj = getObject(sessionId);
if (obj == null) {
return null;
}
return ONode.deserialize(obj.toString(), SaSessionForJson.class);
}


/**
* 获取Value,如无返空
*/
Expand Down Expand Up @@ -117,7 +107,8 @@ public void updateTimeout(String key, long timeout) {
*/
@Override
public Object getObject(String key) {
return get(key);
String value = get(key);
return ONode.deserialize(value);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ public SaTokenDaoOfRedisJson(RedisClient redisClient) {

}

@Override
public SaSession getSession(String sessionId) {
Object obj = getObject(sessionId);
if (obj == null) {
return null;
}
return ONode.deserialize(obj.toString(), SaSessionForJson.class);
}


/**
* 获取Value,如无返空
Expand Down Expand Up @@ -118,7 +109,8 @@ public void updateTimeout(String key, long timeout) {
*/
@Override
public Object getObject(String key) {
return get(key);
String value = get(key);
return ONode.deserialize(value);
}

/**
Expand Down

0 comments on commit 1a62c39

Please sign in to comment.