Caffeine
github.com
What it is
Caffeine is a free, open-source in-memory caching library for Java, distributed under the Apache License, Version 2.0. It provides an API inspired by Google Guava and can load entries automatically, including asynchronously. Size-based eviction uses configured limits with frequency and recency, while entries can expire according to time since their last access or write. When a stale entry is first requested, Caffeine can refresh it asynchronously. Other functions include weak keys, weak or soft values, removal notifications, writes to external resources, and cache statistics. The project offers JSR-107 JCache, Guava adapters, and a simulation extension, with community integrations listed for Spring Cache, Play Framework, Micronaut, Quarkus, and Apache Camel. The project directs users to Maven Central and provides Gradle coordinates for the core library and optional extensions. Version 3.x is intended for Java 11 or newer; earlier Java versions use 2.x. Maven Central artifacts are accompanied by GPG and Sigstore signature files according to the security policy.
Spec sheet
- Purpose
- Caffeine is a high-performance, near-optimal in-memory caching library for Java.Read 9 Oct 2026 · github.com
- Product
- Caffeine is a high-performance, near-optimal in-memory caching library for Java.Read 4 Oct 2026 · github.com
- Integrations
- The project lists community integrations including Spring Cache, Play Framework, Micronaut, Quarkus, Camel, and Kotlin and Scala wrappers.Read 9 Oct 2026 · github.com
- License
- The repository identifies Apache-2.0 as the project license.Read 9 Oct 2026 · github.com
- Artifact signatures
- The security policy states that Maven Central artifacts are accompanied by GPG .asc and Sigstore .sigstore.json files.Read 9 Oct 2026 · github.com
- Artifact validation
- The security policy says Maven Central artifacts are accompanied by GPG .asc and Sigstore .sigstore.json files.Read 4 Oct 2026 · github.com
- Automatic loading
- Cache entries can be loaded automatically, optionally asynchronously.Read 9 Oct 2026 · github.com
- Cache API
- It provides an in-memory cache using an API inspired by Google Guava.Read 9 Oct 2026 · github.com
- Distribution
- The project directs users to Maven Central and shows Gradle dependencies for the core library and optional Guava and JCache extensions.Read 9 Oct 2026 · github.com
- Download
- The project directs users to Maven Central and provides Gradle dependency coordinates for the library and optional Guava and JCache extensions.Read 4 Oct 2026 · github.com
- Eviction
- Size-based eviction uses frequency and recency when a configured maximum is exceeded.Read 9 Oct 2026 · github.com
- Eviction and expiration
- Caffeine supports size-based eviction using frequency and recency, plus time-based expiration measured since last access or write.Read 4 Oct 2026 · github.com
- Expiration and refresh
- Entries can expire based on time since last access or write, and stale entries can refresh asynchronously when first requested.Read 9 Oct 2026 · github.com
- Extensions
- Optional extensions include JSR-107 JCache, Guava adapters, and simulation.Read 9 Oct 2026 · github.com
- Java version
- The README says to use version 3.x for Java 11 or above and 2.x otherwise.Read 9 Oct 2026 · github.com
- Loading
- Caches can load entries automatically, optionally asynchronously.Read 4 Oct 2026 · github.com
- Other cache features
- The library supports weak keys, weak or soft values, removal notifications, writes to external resources, and cache statistics.Read 4 Oct 2026 · github.com
- 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.Read 9 Oct 2026 · github.com
- Refresh
- Caffeine can asynchronously refresh an entry when the first stale request occurs.Read 4 Oct 2026 · github.com
- Security reporting
- The security policy asks users to report security issues privately through GitHub's vulnerability reporting mechanism.Read 9 Oct 2026 · github.com
- Statistics and writes
- Caffeine can accumulate access statistics and propagate writes to an external resource.Read 9 Oct 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- Free Apache-licensed project
- Asynchronous loading and refresh
- Frequency- and recency-aware eviction
- Weak reference options
- JCache and Guava adapters
Limits
- Self-hosted deployment
- Version 3.x requires Java 11 or newer
- In-memory cache only
- No edge caching
Who it suits
Caffeine suits Java developers implementing in-memory application caches. It is self-hosted and supports integrations or adapters for several Java caching ecosystems.
Verdict
Caffeine offers a broad in-memory caching API with configurable loading, eviction, expiration, refresh, references, and statistics. Java version requirements differ by major release, and deployment remains self-hosted.
Where Specifiction places it
- Caching Software#5 of 278.2