cache2k
cache2k.org
- Free plan
- Linux
- Android
- API
- Self-hosted
What cache2k is
cache2k is a free, Apache-licensed in-memory object caching library for Java applications. It is written in pure Java, has no external dependencies, and the project describes its JAR as smaller than 400 KB. Cache behavior includes automatic expiry, refresh and refresh ahead, read-through loading, and event listeners. Loaders can handle exceptions with configurable suppression and retries. The project lists integrations with Spring Framework and Scala Cache, as well as DataNucleus and Hibernate through JCache. It supports JCache / JSR 107, though using that API adds overhead compared with cache2k’s native API. Monitoring options include low-overhead statistics and JMX, with Micrometer metrics documented in the guide. Version 2 requires Java 8 or later; the guide says it is compatible with Android API level 26 and notes that Android CI testing is implemented. The library is available from Maven Central and does not persist data. The project directs bug reports and feature requests to GitHub issues, and usage questions to the cache2k Stack Overflow tag.
Who it suits
cache2k suits Java developers who need in-memory object caching and can work with a library rather than a managed service. It may also suit Android projects that meet its stated compatibility requirements.
Good to know, and what to watch
- Pure Java with no external dependencies
- Automatic expiry, refresh, and read-through loading
- Configurable loader exception handling and retries
- JMX support and documented Micrometer metrics
- Requires at least Java 8
- Does not persist cached data
- JCache use adds overhead over the native API
Plans
Every plan and pricecache2k
Open source
The verdict
cache2k offers a compact, dependency-free Java library with a range of cache behaviors and monitoring options. Its in-memory-only design and the extra overhead of JCache are worth considering when selecting an approach.
What the maker publishes
- Android
- The guide says cache2k version 2 is compatible with Android API level 26 and that Android CI testing is implemented. source
- Cache behavior
- Features include automatic expiry, refresh, refresh ahead, read-through loading, and event listeners. source
- Headquarters
- Munich, Germany source
- Implementation
- It is written in pure Java and does not use sun.misc.Unsafe. source
- Integrations
- The site lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache integrations. source
- License
- The project says its code is released under the Apache license. source
- Lightweight
- The project describes its JAR as smaller than 400 KB and says it has no external dependencies. source
- Limitations
- The guide says JCache API use has additional overhead compared with the native cache2k API. source
- Monitoring
- The project lists low-overhead statistics and JMX support; the guide also documents Micrometer metrics. source
- Purpose
- cache2k is an in-memory object caching library for Java applications. source
- Resilience
- Cache loaders support exception handling, including configurable exception suppression and retries. source
- Runtime requirement
- The version 2.0 release notes state that cache2k requires at least Java 8. source
- Standards
- cache2k supports JCache / JSR 107 and its guide says its implementation follows the corrected TCK 1.1 semantics, with one stated exception. source
- Support
- The project directs bug reports and feature requests to GitHub issues and general usage questions to the cache2k Stack Overflow tag. source
Checked against the maker's pages on 9 Oct 2026.