if(principal!=null){
Integer userId = principal.getId();
System.out.println("userId:" + userId);
String mappingKey = String.format("%s:%s", Configuration.SYSTEM_SESSION_MAPPING_NAMESPACE, userId);
String historySessionId = (String) this.redisTemplate.opsForValue().get(mappingKey);
String sessionKey = String.format("%s:%s", Configuration.SYSTEM_SESSION_NAMESPACE, historySessionId);
this.redisTemplate.expire(sessionKey, 30, TimeUnit.MINUTES);
this.redisTemplate.expire(mappingKey, 30, TimeUnit.MINUTES);
}

为保证长时间登录,不必要使用清空操作,当删除用户后可以调用清空。

相关文章:

  • 2021-12-06
  • 2021-06-21
  • 2021-07-04
  • 2022-02-07
  • 2021-11-13
  • 2021-11-21
  • 2021-11-21
  • 2021-11-21
猜你喜欢
  • 2021-09-10
  • 2021-12-02
  • 2022-02-10
  • 2021-05-02
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
相关资源
相似解决方案