Browse Source

清除用户缓存

sangwenwei 7 months ago
parent
commit
eac921b593

+ 18 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -1630,6 +1630,24 @@ public class UserController {
     }
 
 
+    /**
+     * 清除用户缓存
+     * @param id
+     * @return
+     */
+    @ApiLog("清除用户缓存")
+    @GetMapping("removeRedis")
+    public String removeRedis(String id){
+        if (StringUtils.isNotBlank(id)){
+            UserDTO userDTO = userService.get(id);
+            if (null != userDTO){
+                RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_CODE + userDTO.getLoginName() , 0);
+                UserUtils.deleteCache ( userDTO );
+            }
+        }
+        return "清除登录缓存成功";
+    }
+