【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)


相关推荐
lierenvip13 分钟前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
sxhcwgcy15 分钟前
Spring Boot中集成MyBatis操作数据库详细教程
数据库·spring boot·mybatis
赵丙双26 分钟前
Server-sent events (SSE)
spring·sse·sseemitter
Thomas.Sir39 分钟前
SpringBoot 接口全维度性能优化指南
spring boot·性能优化·状态模式
yuweiade44 分钟前
Spring Boot 整合 MyBatis 与 PostgreSQL 实战指南
spring boot·postgresql·mybatis
程序员阿伦1 小时前
谢飞机面Java大厂:音视频场景下的Spring Boot + Kafka + Redis实战三连问
spring boot·redis·kafka·java面试·音视频架构·微服务容错
毕设源码-钟学长1 小时前
【开题答辩全过程】以 基于Springboot的在线考试系统为例,包含答辩的问题和答案
java·spring boot·后端
Risehuxyc1 小时前
PHP 的缓存机制
开发语言·缓存·php
dovens1 小时前
SpringBoot 集成 Activiti 7 工作流引擎
java·spring boot·后端
SeanDe1 小时前
Canal 详解 + Canal+Redis 缓存一致性完整方案
数据库·redis·缓存