兼容处理UFO设置session缓存非数字的情况
Showing
1 changed file
with
4 additions
and
3 deletions
@@ -151,8 +151,8 @@ public class SecurityInterceptor implements HandlerInterceptor, ApplicationEvent | @@ -151,8 +151,8 @@ public class SecurityInterceptor implements HandlerInterceptor, ApplicationEvent | ||
151 | cacheKey = getSessionCacheKey(jSessionID, clientType, sessionType); | 151 | cacheKey = getSessionCacheKey(jSessionID, clientType, sessionType); |
152 | sessionInfo = valueOperations.get(cacheKey); | 152 | sessionInfo = valueOperations.get(cacheKey); |
153 | if(null == sessionInfo){ //如果REDIS主从延迟, 从主REDIS中获取SESSION | 153 | if(null == sessionInfo){ //如果REDIS主从延迟, 从主REDIS中获取SESSION |
154 | - cacheKey = RedisKeyBuilder.newInstance().appendFixed(SESSION_CACHE_KEY_PRE).appendVar(jSessionID); | ||
155 | - sessionInfo = valueOperations.get(cacheKey); | 154 | + RedisKeyBuilder commonCacheKey = RedisKeyBuilder.newInstance().appendFixed(SESSION_CACHE_KEY_PRE).appendVar(jSessionID); |
155 | + sessionInfo = valueOperations.get(commonCacheKey); | ||
156 | } | 156 | } |
157 | }catch (Exception redisException){ | 157 | }catch (Exception redisException){ |
158 | //如果redis异常,直接放通 | 158 | //如果redis异常,直接放通 |
@@ -161,7 +161,8 @@ public class SecurityInterceptor implements HandlerInterceptor, ApplicationEvent | @@ -161,7 +161,8 @@ public class SecurityInterceptor implements HandlerInterceptor, ApplicationEvent | ||
161 | } | 161 | } |
162 | 162 | ||
163 | //8 session双云同步延迟时,获取用户session | 163 | //8 session双云同步延迟时,获取用户session |
164 | - if(null == sessionInfo){ | 164 | + //兼容处理session缓存值不为数字的情况 |
165 | + if(null == sessionInfo || (StringUtils.isNotEmpty(sessionInfo) && !StringUtils.isNumeric(sessionInfo))){ | ||
165 | sessionInfo = this.getUserSesion(cacheKey,uid, jSessionID, clientType, sessionType); | 166 | sessionInfo = this.getUserSesion(cacheKey,uid, jSessionID, clientType, sessionType); |
166 | } | 167 | } |
167 | 168 |
-
Please register or login to post a comment