spring-cache可以用来进行缓存穿透、缓存击穿、缓存雪崩
demoyml:
pom:
org.springframework.boot spring-boot-starter-cache
@Cacheable:缓存到redis中,@CacheEvict:删除一条缓存
@GetMapping("one")
@Cacheable(cacheNames = "area",key = "#id")
public Stock one(@RequestParam Long id){
return iStockService.getById(id);
}
@GetMapping("removeStockCache")
@CacheEvict(cacheNames = "area",key = "#id" )
public void removeStockCache(@RequestParam Long id){
}



