我正在我的项目中实现一个 redis-shiro 会话管理功能,目前我对 Shiro 和 Redis 的信息很少。
我想知道调用以下内容是否会每次都命中 redis 数据库,以检查 redis 数据库中是否存在任何会话 Id。
服务中的代码
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
控制器中的代码:
public String getSomrthing(@CookieValue("JSESSIONID") String fooCookie){
callingSomeServiceMethod(fooCookie);
return "It does not matter";
}
我们是否必须像我们的服务中那样手动匹配sentialId,或者Shiro会自动匹配它,因为我的应用程序将在多实例环境中运行。
Subject currentUser = SecurityUtils.getSubject();
if(currentUser.getId.equals(fooCookie)){
//.....Some Code
//.....Some Code
}
慕码人2483693
相关分类