cache2k

What cache2k is
cache2k is a free, Apache-licensed in-memory object caching library for Java applications. It keeps Java application objects in memory and offers automatic expiry, refresh, refresh ahead, read-through loading and event listeners. Cache loaders can handle exceptions, with configurable suppression and retries. The project describes its JAR as smaller than 400 KB, with no external dependencies; the implementation is pure Java and does not use sun.misc.Unsafe. Integrations listed include Spring Framework, Scala Cache, DataNucleus through JCache and Hibernate through JCache. cache2k supports JCache / JSR 107, though its guide notes one exception to corrected TCK 1.1 semantics. Monitoring options include low-overhead statistics and JMX, with Micrometer metrics documented in the guide. Version 2 requires at least Java 8 and is described as compatible with Android API level 26. The library is available from Maven Central and supports self-hosted deployment. It 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 application developers who need an in-memory object cache and can manage a self-hosted library. It may fit teams seeking Java framework integrations and monitoring options.
What it does well
- Pure Java implementation with no external dependencies.
- Supports expiry, refresh and read-through loading.
- Offers configurable loader exception suppression and retries.
- Integrates with Spring Framework and other listed tools.
- Apache-licensed and free.
What to know first
- Does not persist cached data.
- JCache API use adds overhead versus the native API.
- Version 2 requires at least Java 8.
Limits
The cache does not persist data. Using the JCache API adds overhead compared with the native cache2k API.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| cache2k | Apache-licensed Java library · available from Maven Central | Free |
As cache2k.org lists them, read 9 Oct 2026. The maker's own page has the final word.
Getting started
- Visit the cache2k website.
- Get the library from Maven Central.
- Use it in a Java application running Java 8 or later.
- Choose the cache2k API or JCache/JSR107; JCache use adds overhead compared with the native API.
- Send bug reports or feature requests through GitHub issues, or ask general usage questions under the cache2k Stack Overflow tag.
Verdict
cache2k provides Java applications with in-memory caching, configurable loader behavior and multiple monitoring options. Its lack of persistence and the added JCache overhead are worth considering when choosing how to use it.
Questions
Is cache2k free?
Yes. The listed cache2k plan is free, and the project releases its code under the Apache license.
What does cache2k do?
It is an in-memory object caching library for Java applications, with features including expiry, refresh, read-through loading, and event listeners.
What platforms are listed?
The listed platforms are Android, API, Linux, and self-hosted. Version 2 requires Java 8 or later and is described as compatible with Android API level 26.
Does cache2k persist data?
No. The listed data persistence value is no.
Which integrations does it support?
The project lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache.
Where can users get help?
The project directs bug reports and feature requests to GitHub issues and general usage questions to the cache2k Stack Overflow tag.
Facts from cache2k's own pages
- Android
- The guide says cache2k version 2 is compatible with Android API level 26 and that Android CI testing is implemented. · cache2k.org, 9 Oct 2026
- Cache behavior
- Features include automatic expiry, refresh, refresh ahead, read-through loading, and event listeners. · cache2k.org, 9 Oct 2026
- Headquarters
- Munich, Germany · cache2k.org, 28 Sept 2026
- Implementation
- It is written in pure Java and does not use sun.misc.Unsafe. · cache2k.org, 9 Oct 2026
- Integrations
- The site lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache integrations. · cache2k.org, 9 Oct 2026
- License
- The project says its code is released under the Apache license. · cache2k.org, 9 Oct 2026
- Lightweight
- The project describes its JAR as smaller than 400 KB and says it has no external dependencies. · cache2k.org, 9 Oct 2026
- Limitations
- The guide says JCache API use has additional overhead compared with the native cache2k API. · cache2k.org, 9 Oct 2026
- Monitoring
- The project lists low-overhead statistics and JMX support; the guide also documents Micrometer metrics. · cache2k.org, 9 Oct 2026
- Purpose
- cache2k is an in-memory object caching library for Java applications. · cache2k.org, 9 Oct 2026
- Resilience
- Cache loaders support exception handling, including configurable exception suppression and retries. · cache2k.org, 9 Oct 2026
- Runtime requirement
- The version 2.0 release notes state that cache2k requires at least Java 8. · cache2k.org, 9 Oct 2026
- Standards
- cache2k supports JCache / JSR 107 and its guide says its implementation follows the corrected TCK 1.1 semantics, with one stated exception. · cache2k.org, 9 Oct 2026
- Support
- The project directs bug reports and feature requests to GitHub issues and general usage questions to the cache2k Stack Overflow tag. · cache2k.org, 9 Oct 2026
Where cache2k stands on Freedom251
- Caching Software#5 of 27