A high performance caching library for Java
17.8k
Stars
1.7k
Forks
1
Open issues
30
Contributors
AI Analysis
Caffeine is a high-performance, in-memory caching library for Java that provides automatic loading, size-based eviction, time-based expiration, and asynchronous refresh capabilities. It serves Java developers building applications requiring low-latency cache operations with flexible eviction policies, and is particularly valuable for teams migrating from or extending Google's Guava cache. Not intended for distributed caching scenarios or cache systems that require cross-process sharing.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Caffeine: Java's de-facto in-process cache library, backed by near-optimal eviction algorithms
Caffeine is a high-performance, in-memory caching library for Java that implements the W-TinyLFU eviction policy, offering near-optimal hit rates with low overhead. It is used across a wide range of production systems including Apache Kafka, Cassandra, Neo4j, Apache Solr, Druid, and many others. Built as a spiritual successor to Guava's cache, it targets Java backend developers who need a reliable, zero-dependency local cache with flexible expiration, async loading, weak/soft reference support, and JCache (JSR-107) compatibility. It is integrated into Spring, Quarkus, Micronaut, and other major Java frameworks.
Created in December 2014 by Ben Manes, who had previously built ConcurrentLinkedHashMap and contributed to Guava's cache. Caffeine formalized and extended research into TinyLFU eviction policies, co-authoring academic papers on the algorithm.
Growth has been steady and organic, driven by adoption in foundational Java infrastructure (Kafka, Cassandra, Solr) and first-class integration in major frameworks (Spring Boot, Quarkus, Micronaut). The Guava cache migration path lowered adoption friction significantly. Stars accumulate slowly but consistently — approximately 16 per week as of mid-2026 — reflecting a mature library rather than a trending project. Adoption is usage-driven, not hype-driven.
Extensive documented production usage: Apache Kafka, Cassandra, HBase, Apache Solr, Neo4j, Druid, Infinispan, Redisson, Finagle, OpenWhisk, and Coherence all list Caffeine as an infrastructure dependency. Spring Cache, Quarkus, and Micronaut ship Caffeine as a first-class cache provider. This constitutes among the strongest adoption evidence visible for any JVM library.
Appears to implement a concurrent, non-blocking cache backed by the W-TinyLFU policy (Window Tiny Least Frequently Used), which combines a frequency sketch with recency awareness. Likely uses a lock-free or low-contention amortized write-buffer design for high throughput. Supports synchronous and asynchronous cache loading, multiple eviction dimensions (size, time, references), and listener callbacks. Extensions for JCache and Guava adapter are modularized as separate artifacts.
Coverage is tracked via Coveralls and shown as a badge in the README. Based on the presence of a test-count badge linked to CI runs, the project appears to have an extensive automated test suite. Exact coverage percentage is not stated in the README excerpt, but the infrastructure signals active quality maintenance.
Last push was 2026-06-26 — the same day as the analysis date — indicating active, ongoing development. CI is configured via GitHub Actions. The project uses Develocity (Gradle build scanning). Version 3.2.4 is current for Java 11+, with a separate 2.x line maintained for older Java. These signals collectively indicate a well-maintained, actively developed project with no signs of abandonment.
ADOPT IF: you need a high-performance, in-process Java cache with flexible eviction, async loading, and framework integration — this is the standard choice for JVM local caching and has proven production pedigree. AVOID IF: you need distributed, multi-node, off-heap, or persistent caching — Caffeine is strictly in-process and in-heap; a distributed cache or data grid is required for those scenarios. MONITOR IF: you are evaluating multi-level cache architectures where Caffeine would serve as the L1 tier alongside a remote store — the integration ecosystem continues to evolve.
Independent dimensions
Mainstream potential
7/10
Technical importance
9/10
Adoption evidence
10/10
- Single maintainer dependency: the project is primarily maintained by Ben Manes. Bus-factor risk exists, though the codebase appears mature and the license is permissive.
- In-heap only: all cached data consumes JVM heap, which can increase GC pressure at large cache sizes. Off-heap alternatives may be needed for very large caches.
- Not a distributed cache: teams that eventually need cross-node consistency or replication will need to add a separate layer; Caffeine does not scale horizontally.
- Java-only: no official support for other JVM languages beyond community wrappers (Scala's Scaffeine, Kotlin's Aedile). Teams on non-JVM stacks need different solutions.
- Complexity of advanced features: async refresh, compute, and write-propagation behaviors can be subtle to configure correctly under concurrent load; misconfigurations may produce non-obvious results.
Caffeine is likely to remain the default local cache choice for Java/JVM applications for the foreseeable future. Adoption will continue to grow incrementally as the Java ecosystem grows, with no credible challenger currently visible.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- Java
- License
- Apache-2.0
- Last updated
- 2d ago
- Created
- 141mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Top contributors
Recent releases
Similar repos
CaffeineMC/lithium
Lithium is a free, open-source Minecraft mod that optimizes game performance on...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
17.8k | +14 | Java | 9/10 | 2d ago |
|
|
5.6k | — | Java | 8/10 | 4d ago |
|
|
2.1k | — | Java | 7/10 | 2mo ago |
|
|
3.2k | — | Java | 8/10 | 1d ago |
|
|
2.1k | — | Java | 8/10 | 3d ago |
|
|
14.2k | — | C | 8/10 | 9h ago |
Caffeine is the acknowledged successor; Guava cache is widely considered deprecated for caching use cases. Caffeine offers better hit rates, higher throughput, and async loading. Caffeine provides a Guava adapter for drop-in compatibility.
Ehcache targets enterprise use cases with off-heap, disk persistence, and clustering. Caffeine is strictly in-process and in-heap, making it simpler, faster, and lower overhead. They serve overlapping but distinct needs; Caffeine is often used alongside distributed caches rather than as a replacement.
JetCache provides a higher-level annotation-driven caching abstraction with multi-level (local + remote) cache support, targeting Spring applications. Caffeine can be used as JetCache's local tier. JetCache is framework-opinionated; Caffeine is a lower-level primitive.
EVCache is a distributed, Memcached-based cache designed for multi-region Netflix infrastructure. It solves a fundamentally different problem — remote distributed caching at scale — whereas Caffeine is an in-process cache. They are complementary rather than competing.
Infinispan is a full distributed in-memory data grid supporting clustering, persistence, and transactions. Caffeine is embedded and local only. Notably, Infinispan itself uses Caffeine internally for its local caching layer, illustrating the complementary relationship.