SpringBoot 缓存01

#配置

1.主应用开启缓存

@EnableCaching

2.方法配置@Cacheable

@GetMapping("/get")
@Cacheable(value = "users", key = "#id")
@ApiOperation(value="缓存")
public Result<Map<String ,Object>> getId(@RequestParam("sid") String id){
log.debug("-> get id="+id);
Map<String ,Object> jo=new HashMap<String ,Object>();
jo.put("id", id);
jo.put("info", "get data success!");
return Result.success(jo);
}

3.如何查看 缓存的数据呢?

猜你喜欢

转载自www.cnblogs.com/zhima/p/10031065.html