cache2k
cache2k.org
What it is
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.
Spec sheet
- Purpose
- cache2k is an in-memory object caching library for Java applications.Read 9 Oct 2026 · cache2k.org
- Integrations
- The site lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache integrations.Read 9 Oct 2026 · cache2k.org
- Support
- The project directs bug reports and feature requests to GitHub issues and general usage questions to the cache2k Stack Overflow tag.Read 9 Oct 2026 · cache2k.org
- License
- The project says its code is released under the Apache license.Read 9 Oct 2026 · cache2k.org
- Headquarters
- Munich, GermanyRead 28 Sep 2026 · cache2k.org
- Android
- The guide says cache2k version 2 is compatible with Android API level 26 and that Android CI testing is implemented.Read 9 Oct 2026 · cache2k.org
- Cache behavior
- Features include automatic expiry, refresh, refresh ahead, read-through loading, and event listeners.Read 9 Oct 2026 · cache2k.org
- Implementation
- It is written in pure Java and does not use sun.misc.Unsafe.Read 9 Oct 2026 · cache2k.org
- Lightweight
- The project describes its JAR as smaller than 400 KB and says it has no external dependencies.Read 9 Oct 2026 · cache2k.org
- Limitations
- The guide says JCache API use has additional overhead compared with the native cache2k API.Read 9 Oct 2026 · cache2k.org
- Monitoring
- The project lists low-overhead statistics and JMX support; the guide also documents Micrometer metrics.Read 9 Oct 2026 · cache2k.org
- Resilience
- Cache loaders support exception handling, including configurable exception suppression and retries.Read 9 Oct 2026 · cache2k.org
- Runtime requirement
- The version 2.0 release notes state that cache2k requires at least Java 8.Read 9 Oct 2026 · cache2k.org
- Standards
- cache2k supports JCache / JSR 107 and its guide says its implementation follows the corrected TCK 1.1 semantics, with one stated exception.Read 9 Oct 2026 · cache2k.org
Plans and prices
Strong points and limits
Strong points
- JAR is described as smaller than 400 KB
- No external dependencies
- Supports expiry, refresh, and read-through loading
- Offers JMX and Micrometer monitoring
- Apache-licensed and free
Limits
- Requires Java 8 or later
- Does not persist cached data
- JCache API adds overhead versus native API
Who it suits
It suits Java developers needing an in-memory object cache for self-hosted applications, including Android API 26 environments.
Verdict
cache2k provides a small, dependency-free Java cache with configurable loading behavior and several integration paths. Its in-memory design omits persistence, and JCache users should account for the documented overhead.
Where Specifiction places it
- Caching Software#6 of 278.1