修改新的注销逻辑

parent 7b1f65a7
...@@ -181,21 +181,16 @@ public class SessionServiceImpl implements ISessionService { ...@@ -181,21 +181,16 @@ public class SessionServiceImpl implements ISessionService {
@Override @Override
public void deleteByUserId(long userId) { public void deleteByUserId(long userId) {
String pattern = Constants.Session.USER_SESSION_ID_CACHE + ":" + String.valueOf(userId) + ":*";
Set<String> keys = stringRedisTemplate.keys(pattern);
if (!CollectionUtils.isEmpty(keys)) {
log.info("删除用户userId={}的缓存信息,个数:{},keys={}", userId,
keys.size(),
Joiner.on(",").join(keys));
}
/* Set useIdKeys = stringRedisTemplate.opsForSet().members(Constants.Session.USER_SESSION_KEY_SET + userId); Set useIdKeys = stringRedisTemplate.opsForSet().members(Constants.Session.USER_SESSION_KEY_SET + userId);
if (!CollectionUtils.isEmpty(useIdKeys)) { if (!CollectionUtils.isEmpty(useIdKeys)) {
useIdKeys.forEach(key -> { useIdKeys.forEach(key -> {
log.info("删除用户userId={}的缓存信息",userId); log.info("删除用户userId={}的缓存信息", userId);
stringRedisTemplate.delete(String.valueOf(key)); stringRedisTemplate.delete(String.valueOf(key));
}); });
}*/ stringRedisTemplate.delete(Constants.Session.USER_SESSION_KEY_SET + userId);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment