...
|
...
|
@@ -40,7 +40,7 @@ public class LoginSessionService { |
|
|
if (StringUtils.isBlank(pid)) {
|
|
|
return null;
|
|
|
}
|
|
|
String userRedisValue = yhValueOperations.get(RedisKeyBuilder.newInstance().appendFixed(getUserKey(request, Integer.parseInt(pid))));
|
|
|
String userRedisValue = yhValueOperations.get(RedisKeyBuilder.newInstance().appendFixed(getUserKey(request, pid)));
|
|
|
logger.info( "getLoginSession userRedisValue is {}.", userRedisValue);
|
|
|
if (StringUtils.isBlank(userRedisValue)) {
|
|
|
return null;
|
...
|
...
|
@@ -53,16 +53,16 @@ public class LoginSessionService { |
|
|
/**
|
|
|
* 设置登录用户的缓存
|
|
|
*/
|
|
|
public void setLoginSession(UserInfoResponseBO userInfoResponseBO, HttpServletRequest request, int pid) {
|
|
|
public void setLoginSession(UserInfoResponseBO userInfoResponseBO, HttpServletRequest request, String pid) {
|
|
|
logger.info( "setLoginSession userInfoResponseBO is {} and pid is {}.", userInfoResponseBO,pid);
|
|
|
yhValueOperations.set(RedisKeyBuilder.newInstance().appendFixed(getPidKey(request)), String.valueOf(pid), 2, TimeUnit.HOURS);
|
|
|
yhValueOperations.set(RedisKeyBuilder.newInstance().appendFixed(getUserKey(request, pid)), JSON.toJSONString(userInfoResponseBO), 2, TimeUnit.HOURS);
|
|
|
//yhValueOperations.set(RedisKeyBuilder.newInstance().appendFixed(getPidKey(request)), String.valueOf(pid), 2, TimeUnit.HOURS);
|
|
|
yhValueOperations.set(RedisKeyBuilder.newInstance().appendFixed(getUserKey(request, pid)), JSON.toJSONString(userInfoResponseBO), 20, TimeUnit.MINUTES);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 清除登录用户的缓存
|
|
|
*/
|
|
|
public void clearLoginSession(HttpServletRequest request, int pid){
|
|
|
public void clearLoginSession(HttpServletRequest request, String pid){
|
|
|
logger.info( "clearLoginSession pid is {}.", pid);
|
|
|
String pidKey = getPidKey(request);
|
|
|
String userKey = getUserKey(request, pid);
|
...
|
...
|
@@ -75,8 +75,8 @@ public class LoginSessionService { |
|
|
return RedisKeyConstants.LOGIN_PID_PRE + getRemoteIp(request);
|
|
|
}
|
|
|
|
|
|
public String getUserKey(HttpServletRequest request, int pid) {
|
|
|
return RedisKeyConstants.LOGIN_USER_PRE + pid + "_" + getRemoteIp(request);
|
|
|
public String getUserKey(HttpServletRequest request, String pid) {
|
|
|
return RedisKeyConstants.LOGIN_USER_PRE + pid;// + "_" + getRemoteIp(request);
|
|
|
}
|
|
|
|
|
|
private String getRemoteIp(HttpServletRequest request) {
|
...
|
...
|
|