package com.diagbot.web;

import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.CacheFacade;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 缓存 前端控制器
 * </p>
 *
 * @author zhoutg
 * @since 2018-12-25
 */
@RequestMapping("/cache")
@RestController
@SuppressWarnings("unchecked")
@Api(value = "缓存API", tags = { "缓存API" })
public class CacheController {


    @Autowired
    CacheFacade cacheFacade;

    @ApiOperation(value = "清除缓存[by:zhoutg]",
            notes = "")
    @PostMapping("/clear")
    @SysLogger("clear")
    public RespDTO<Boolean> clear() {
        cacheFacade.clear();
        return RespDTO.onSuc(true);
    }
}
