cache2k
cache2k is an in-memory object caching library for Java applications.
What cache2k is
cache2k is an in-memory object caching library for Java applications. It keeps Java application objects in memory and supports automatic expiry, refresh, refresh ahead, read-through loading, and event listeners. Its pure Java implementation has no external dependencies, and the project describes its JAR as smaller than 400 KB. Cache loaders can handle exceptions with configurable suppression and retries. Integrations listed by the project include Spring Framework, Scala Cache, DataNucleus through JCache, 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, JMX, and documented Micrometer metrics. Version 2 requires at least Java 8 and is described as compatible with Android API level 26. The library is Apache-licensed, available from Maven Central, and free; it does not persist data. Bug reports and feature requests go to GitHub issues, while usage questions are directed to the cache2k Stack Overflow tag.
Good
- Pure Java with no external dependencies.
- Supports refresh, expiry, and read-through loading.
- Offers JMX, statistics, and Micrometer metrics.
- Integrates with Spring Framework and Scala Cache.
Watch out
- Does not persist cached data.
- JCache API use adds overhead over the native API.
- Version 2 requires at least Java 8.
Who it suits
It suits Java developers who need an in-memory cache with configurable expiry, refresh, and loader behavior. Teams needing persistence should note that cache2k does not persist data.
Verdict
cache2k provides a focused, Apache-licensed cache for Java application objects, with several loading, monitoring, and integration options. Its lack of persistence and the additional overhead of JCache use are important considerations.
Plans and prices
From cache2k's own pricing page, checked 9 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| cache2k | Free | Apache-licensed Java library · available from Maven Central |
The facts
Each one read from cache2k's own pages, with the date it was checked.
Where it runs
- Android
- The guide says cache2k version 2 is compatible with Android API level 26 and that Android CI testing is implemented.checked 9 Oct 2026
What it does
- Cache behavior
- Features include automatic expiry, refresh, refresh ahead, read-through loading, and event listeners.checked 9 Oct 2026
- Implementation
- It is written in pure Java and does not use sun.misc.Unsafe.checked 9 Oct 2026
- Integrations
- The site lists Spring Framework, Scala Cache, DataNucleus through JCache, and Hibernate through JCache integrations.checked 9 Oct 2026
- License
- The project says its code is released under the Apache license.checked 9 Oct 2026
- Lightweight
- The project describes its JAR as smaller than 400 KB and says it has no external dependencies.checked 9 Oct 2026
- Limitations
- The guide says JCache API use has additional overhead compared with the native cache2k API.checked 9 Oct 2026
- Monitoring
- The project lists low-overhead statistics and JMX support; the guide also documents Micrometer metrics.checked 9 Oct 2026
- Purpose
- cache2k is an in-memory object caching library for Java applications.checked 9 Oct 2026
- Resilience
- Cache loaders support exception handling, including configurable exception suppression and retries.checked 9 Oct 2026
- Runtime requirement
- The version 2.0 release notes state that cache2k requires at least Java 8.checked 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.checked 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.checked 9 Oct 2026
The company
- Headquarters
- Munich, Germanychecked 28 Sep 2026
Alternatives to cache2k
- 1

Amazon ElastiCache
Free planWebAPILinuxmacOS7.9From $0.09 a month - 2

Apache Traffic Server
Free planOpen sourceAPILinuxmacOSSelf-hosted7.2Free plan - 3
Ehcache
Free planOpen sourceAPISelf-hosted6.9Free plan - 4

Aiven for Valkey
Free planWebAPILinux6.8From $15 a month - 5
Google Cloud Memorystore
WebAPI6.4From $0.05 a month - 6
Garnet
Free planLinuxmacOSSelf-hostedWindows6.2Free plan
