diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java index a9c951da8..8212bbc13 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java @@ -182,8 +182,8 @@ public R removeToken(@PathVariable("token") String token) { if (accessToken == null || StrUtil.isBlank(accessToken.getToken().getTokenValue())) { return R.ok(); } - // 清空用户信息 - cacheManager.getCache(CacheConstants.USER_DETAILS).evict(authorization.getPrincipalName()); + // 清空用户信息(立即删除) + cacheManager.getCache(CacheConstants.USER_DETAILS).evictIfPresent(authorization.getPrincipalName()); // 清空access token authorizationService.remove(authorization); // 处理自定义退出事件,保存相关日志 diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java index ba0d1097e..2dbffbc04 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java @@ -192,7 +192,8 @@ public Boolean deleteUserByIds(Long[] ids) { List userList = baseMapper.selectBatchIds(CollUtil.toList(ids)); Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS); for (SysUser sysUser : userList) { - cache.evict(sysUser.getUsername()); + // 立即删除 + cache.evictIfPresent(sysUser.getUsername()); } sysUserRoleMapper.delete(Wrappers.lambdaQuery().in(SysUserRole::getUserId, CollUtil.toList(ids)));