文章目录
- 一、导入Maven依赖:
- 二、实现思路:
- 三、代码开发:
一、导入Maven依赖:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId><version>2.7.3</version>
</dependency>
二、实现思路:
三、代码开发:
@Cacheable(cacheNames = "setmealCache",key = "#categoryId")
@CacheEvict(cacheNames = "setmealCache",key = "#setmealDTO.categoryId")//key: setmealCache::100@CacheEvict(cacheNames = "setmealCache",allEntries = true)