Caffeine
Caffeine is a free, open-source in-memory caching library for Java applications.
What Caffeine is
Caffeine is a free, open-source in-memory caching library for Java applications. It can load cache entries automatically, with an option to do so asynchronously. When a configured size limit is reached, its eviction approach considers frequency and recency; entries can also expire based on time since their last access or write. Caffeine can refresh an entry asynchronously when the first request arrives after it becomes stale. Other capabilities include weak keys, weak or soft values, removal notifications, writes to external resources, and cache statistics. The project offers JSR-107 JCache and Guava adapters, along with a simulation extension. It also lists community integrations including Spring Cache, Play Framework, Micronaut, Quarkus, and Apache Camel. The library is available through Maven Central, with Gradle coordinates for the core library and optional Guava and JCache extensions. The project recommends version 3.x for Java 11 or newer and version 2.x for earlier Java versions. Caffeine is distributed under the Apache License, Version 2.0.
Good
- Automatically loads cache entries, optionally asynchronously
- Eviction considers frequency and recency
- Supports time-based expiration and asynchronous refresh
- Offers JCache and Guava adapters
- Distributed under the Apache License, Version 2.0
Watch out
- Version 3.x requires Java 11 or newer
- Version 2.x is specified for earlier Java versions
- Designed for in-memory application data, not edge caching
Who it suits
Caffeine suits Java developers who need an in-memory cache with configurable loading, eviction, expiration, and refresh behavior. Its extensions and listed community integrations may also fit projects using JCache, Guava, or the named frameworks.
Verdict
Caffeine provides Java applications with cache loading, eviction, expiration, and refresh options in a free, open-source library. Choose the version that matches the Java version used by your project.
Plans and prices
From Caffeine's own pricing page, checked 9 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Caffeine | Free | Open-source Java caching library · Java 11+ for 3.x; Java versions below 11 use 2.x |
The facts
Each one read from Caffeine's own pages, with the date it was checked.
What it does
- Artifact signatures
- The security policy states that Maven Central artifacts are accompanied by GPG .asc and Sigstore .sigstore.json files.checked 9 Oct 2026
- Artifact validation
- The security policy says Maven Central artifacts are accompanied by GPG .asc and Sigstore .sigstore.json files.checked 4 Oct 2026
- Automatic loading
- Cache entries can be loaded automatically, optionally asynchronously.checked 9 Oct 2026
- Cache API
- It provides an in-memory cache using an API inspired by Google Guava.checked 9 Oct 2026
- Distribution
- The project directs users to Maven Central and shows Gradle dependencies for the core library and optional Guava and JCache extensions.checked 9 Oct 2026
- Download
- The project directs users to Maven Central and provides Gradle dependency coordinates for the library and optional Guava and JCache extensions.checked 4 Oct 2026
- Eviction
- Size-based eviction uses frequency and recency when a configured maximum is exceeded.checked 9 Oct 2026
- Eviction and expiration
- Caffeine supports size-based eviction using frequency and recency, plus time-based expiration measured since last access or write.checked 4 Oct 2026
- Expiration and refresh
- Entries can expire based on time since last access or write, and stale entries can refresh asynchronously when first requested.checked 9 Oct 2026
- Extensions
- Optional extensions include JSR-107 JCache, Guava adapters, and simulation.checked 9 Oct 2026
- Integrations
- The project lists community integrations including Spring Cache, Play Framework, Micronaut, Quarkus, Camel, and Kotlin and Scala wrappers.checked 9 Oct 2026
- Java version
- The README says to use version 3.x for Java 11 or above and 2.x otherwise.checked 9 Oct 2026
- License
- The repository identifies Apache-2.0 as the project license.checked 9 Oct 2026
- Loading
- Caches can load entries automatically, optionally asynchronously.checked 4 Oct 2026
- Other cache features
- The library supports weak keys, weak or soft values, removal notifications, writes to external resources, and cache statistics.checked 4 Oct 2026
- Product
- Caffeine is a high-performance, near-optimal in-memory caching library for Java.checked 4 Oct 2026
- Purpose
- Caffeine is a high-performance, near-optimal in-memory caching library for Java.checked 9 Oct 2026
- References and removal
- Keys can use weak references, values can use weak or soft references, and the cache can notify when entries are evicted or removed.checked 9 Oct 2026
- Refresh
- Caffeine can asynchronously refresh an entry when the first stale request occurs.checked 4 Oct 2026
- Security reporting
- The security policy asks users to report security issues privately through GitHub's vulnerability reporting mechanism.checked 9 Oct 2026
- Statistics and writes
- Caffeine can accumulate access statistics and propagate writes to an external resource.checked 9 Oct 2026
Alternatives to Caffeine
- 1

Amazon ElastiCache
Free planWebAPILinuxmacOS7.9From $0.09 a month - 2

Apache Traffic Server
Free planOpen sourceAPILinuxmacOSSelf-hosted7.2Free plan - 3
Ehcache
Free planOpen sourceAPISelf-hosted6.9Free plan - 4

Aiven for Valkey
Free planWebAPILinux6.8From $15 a month - 5
Google Cloud Memorystore
WebAPI6.4From $0.05 a month - 6
cache2k
Free planAndroidAPILinuxSelf-hosted6.2Free plan
