|
@@ -5,10 +5,12 @@ import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.facade.CacheFacade;
|
|
import com.diagbot.facade.CacheFacade;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.vo.IdListVO;
|
|
import com.diagbot.vo.IdListVO;
|
|
-import com.diagbot.vo.IdVO;
|
|
|
|
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.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
+import org.springframework.cache.annotation.Caching;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -27,7 +29,7 @@ import java.util.List;
|
|
@RequestMapping("/cache")
|
|
@RequestMapping("/cache")
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
@Api(value = "缓存相关API", tags = { "缓存相关API" })
|
|
@Api(value = "缓存相关API", tags = { "缓存相关API" })
|
|
-@ApiIgnore
|
|
|
|
|
|
+@Slf4j
|
|
public class CacheController {
|
|
public class CacheController {
|
|
@Autowired
|
|
@Autowired
|
|
CacheFacade cacheFacade;
|
|
CacheFacade cacheFacade;
|
|
@@ -37,6 +39,7 @@ public class CacheController {
|
|
@PostMapping("/clearCache")
|
|
@PostMapping("/clearCache")
|
|
@SysLogger("clearCache")
|
|
@SysLogger("clearCache")
|
|
@Transactional
|
|
@Transactional
|
|
|
|
+ @ApiIgnore
|
|
public RespDTO<Boolean> clearCache(@RequestBody IdListVO idListVO) {
|
|
public RespDTO<Boolean> clearCache(@RequestBody IdListVO idListVO) {
|
|
List<Long> ids = idListVO.getIdList();
|
|
List<Long> ids = idListVO.getIdList();
|
|
if (ListUtil.isNotEmpty(ids)) {
|
|
if (ListUtil.isNotEmpty(ids)) {
|
|
@@ -46,4 +49,17 @@ public class CacheController {
|
|
}
|
|
}
|
|
return RespDTO.onSuc(true);
|
|
return RespDTO.onSuc(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "清除所有缓存[by:gaodm]",
|
|
|
|
+ notes = "")
|
|
|
|
+ @PostMapping("/allClear")
|
|
|
|
+ @SysLogger("allClear")
|
|
|
|
+ @Caching(evict = { @CacheEvict(value = "icss-service", allEntries = true),
|
|
|
|
+ @CacheEvict(value = "data-service", allEntries = true),
|
|
|
|
+ @CacheEvict(value = "aipt-service", allEntries = true),
|
|
|
|
+ @CacheEvict(value = "tagCache", allEntries = true) })
|
|
|
|
+ public RespDTO<Boolean> allClear() {
|
|
|
|
+ log.info("清理了icss,data,aipt的所有缓存!");
|
|
|
|
+ return RespDTO.onSuc(true);
|
|
|
|
+ }
|
|
}
|
|
}
|