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