跳至主要內容
Spring Boot Cache With Redis

本篇文章将介绍如何使用 Redis 作为数据源,实现 Spring Boot 的方法缓存。

引入相关依赖

要实现方法缓存,首先需要引入 spring-boot-starter-cachespring-boot-starter-data-redis 这两个依赖。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

cpgege原创大约 3 分钟随笔Spring BootCache