Caffeine is a high performance in-memory caching library for Java that provides a Google Guava inspired API with modern improvements.
The library addresses the need for efficient cache management in Java applications by implementing a sophisticated eviction policy based on frequency and recency of access. It combines automatic entry loading, size-based and time-based expiration, asynchronous refresh capabilities, and weak or soft reference wrapping for keys and values. The tool also supports cache statistics collection, external resource synchronization through write-through operations, and entry eviction notifications.
Caffeine suits projects requiring predictable cache performance and memory efficiency. It works well for applications already using Spring Cache, Play Framework, Micronaut, or other frameworks with Caffeine integrations. The library is particularly valuable when you need fine-grained control over eviction behavior and want to avoid the overhead of distributed caching systems. Developers familiar with Guava's cache API will find Caffeine's interface natural, though the library represents a cleaner design informed by experience with Guava's implementation and the earlier ConcurrentLinkedHashMap project. The tool also provides JSR-107 JCache compliance and community wrappers for Scala and Kotlin.
Maintainers respond to issues and pull requests within hours, indicating active engagement with the user base. Development activity is primarily focused on enhancements, suggesting the project prioritizes feature expansion and optimization over bug fixes.