【springboot】Spring Cache缓存:

文章目录


一、导入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)


相关推荐
武子康7 小时前
Java-08 深入浅出 Mybatis 数据库多对多关系设计:中间表、映射与性能优化
java·后端·spring
明夜之约7 小时前
Spring Cloud Gateway 深度解析:从路由原理到生产级网关实战
java·spring·spring cloud·gateway
Simon523147 小时前
Spring Bean----5.27学习小记
java·学习·spring
Will_Ye7 小时前
Ubuntu中pip 缓存和conda的缓存路径修改
缓存·conda·pip
草木红7 小时前
Redis 语法基础入门
数据库·redis·缓存
夕除8 小时前
spring boot 16
java·spring boot·后端
努力成为AK大王8 小时前
Spring Bean 作用域与生命周期
java·后端·spring
霸道流氓气质8 小时前
Caffeine 本地缓存详解与实战指南
缓存
希望永不加班8 小时前
SpringBoot 消息幂等性设计:防重复消费
java·开发语言·spring boot·后端·spring