Skip to content
SPECIFICTION
Get listed

cache2k vs Caffeine

cache2k

cache2k.org

Caffeine

github.com

Side by side

Figurecache2kCaffeine
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
LinuxYes—
AndroidYes—
APIYes—
Self-hostedYesYes
Plans published11
Spec score · Caching Software8.1 (#6)8.2 (#5)
IntegrationsThe site lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache integrations.The project lists community integrations including Spring Cache, Play Framework, Micronaut, Quarkus, Camel, and Kotlin and Scala wrappers.
LicenseThe project says its code is released under the Apache license.The repository identifies Apache-2.0 as the project license.
Purposecache2k is an in-memory object caching library for Java applications.Caffeine is a high-performance, near-optimal in-memory caching library for Java.

Plans

cache2k

  • cache2kFree

cache2k pricing →

Caffeine

  • CaffeineFree

Caffeine pricing →

In their own words

cache2k

cache2k is an Apache-licensed, open-source library that keeps Java application objects in memory. Its project describes a JAR smaller than 400 KB with no external dependencies, and the implementation is written in pure Java without sun.misc.Unsafe. Cache behavior includes automatic expiry, refresh, refresh ahead, read-through loading, and event listeners. Cache loaders can suppress exceptions or retry them according to configuration. Integrations listed include Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache. cache2k supports JCache / JSR 107, while its guide notes extra overhead for that API compared with the native interface. Monitoring options include low-overhead statistics, JMX, and documented Micrometer metrics. Version 2 requires Java 8 or later and is described as compatible with Android API level 26. The library is free, available from Maven Central, self-hosted, and does not persist data.

Visit cache2k.org

Caffeine

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.

Visit github.com