Selaa lähdekoodia

清理ICSS相关缓存接口

gaodm 5 vuotta sitten
vanhempi
commit
3d804e54e2

+ 18 - 1
icss-service/src/main/java/com/diagbot/web/CacheController.java

@@ -2,9 +2,13 @@ package com.diagbot.web;
 
 
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.CacheFacade;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Caching;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -18,9 +22,12 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/cache")
 @RequestMapping("/cache")
 @Api(value = "缓存相关API", tags = { "缓存相关API" })
 @Api(value = "缓存相关API", tags = { "缓存相关API" })
 @SuppressWarnings("unchecked")
 @SuppressWarnings("unchecked")
+@Slf4j
 public class CacheController {
 public class CacheController {
+    @Autowired
+    CacheFacade cacheFacade;
 
 
-    @ApiOperation(value = "清空缓存[by:gaodm]",
+    @ApiOperation(value = "清空标签缓存[by:gaodm]",
             notes = "")
             notes = "")
     @PostMapping("/clear")
     @PostMapping("/clear")
     @SysLogger("clear")
     @SysLogger("clear")
@@ -28,4 +35,14 @@ public class CacheController {
     public RespDTO<Boolean> clearCache() {
     public RespDTO<Boolean> clearCache() {
         return RespDTO.onSuc(true);
         return RespDTO.onSuc(true);
     }
     }
+
+    @ApiOperation(value = "清除所有缓存[by:gaodm]",
+            notes = "")
+    @PostMapping("/allClear")
+    @SysLogger("allClear")
+    public RespDTO<Boolean> allClear() {
+        cacheFacade.clear();
+        log.info("清理ICSS,AIPT缓存成功!");
+        return RespDTO.onSuc(true);
+    }
 }
 }