1. Overview

Caffeine cache is a high-performance cache library for Java. In this short tutorial, we’ll see how to use it with Spring Boot.

2. Dependencies

To get started with Caffeine and Spring Boot, we first add thespring-boot-starter-cacheand caffeine dependencies:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.ben-manes.caffeine</groupId>
        <artifactId>caffeine</artifactId>
    </dependency>
</dependencies>

These import the base Spring caching support, along with the Caffeine library.

#spring-boot #java #developer

How to use Caffeine Cache with Spring Boot
63.15 GEEK