清除redis缓存
This commit is contained in:
parent
6f14256fb5
commit
c02ecb336d
|
|
@ -8,12 +8,12 @@ import com.nflg.product.bomnew.service.BomNewLogService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* t_bom_new_log 表控制层
|
||||
|
|
@ -27,6 +27,8 @@ import javax.annotation.Resource;
|
|||
@RequestMapping("bomNewLogEntity")
|
||||
public class BomNewLogApi extends BaseApi {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
|
|
@ -44,7 +46,15 @@ public class BomNewLogApi extends BaseApi {
|
|||
public ResultVO<IPage<BomNewLogEntity>> selectBomNewLogEntityPageByCondition(@RequestBody BomNewLogQuery query) {
|
||||
return ResultVO.success(bomNewLogService.getListByPage(query));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("delRedisKey")
|
||||
public ResultVO<Long> delRedisKey(@RequestParam(name = "key") @Length(min = 4, message = "长度不能少于4个字符") String key){
|
||||
Set<String> keys = redisTemplate.keys(key);
|
||||
if(!keys.isEmpty()){
|
||||
return ResultVO.success(redisTemplate.delete(keys));
|
||||
}
|
||||
return ResultVO.success(0l);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue