cache2k – High Performance Java Caching

cache2k focuses on providing a well engineered in-memory object cache implementation for Java applications.

Cache<String,String> cache = new Cache2kBuilder<String, String>() {} .expireAfterWrite(5, TimeUnit.MINUTES) // expire/refresh after 5 minutes .resilienceDuration(30, TimeUnit.SECONDS) // cope with at most 30 seconds // outage before propagating // exceptions .refreshAhead(true) // keep fresh when expiring .loader(this::expensiveOperation) // auto populating function .build();

For a detailed introduction continue with Getting Started.

Integrations Spring Framework

Scala Cache

Datanucleus (via JCache)

Hibernate (via JCache)

…. and probably more, please raise an issue and get it listed!

Feedback Please use the GitHub issue tracker for bugs and wishes you step upon. We also monitor the stackoverflow.com tag cache2k for general usage questions.

License The code is released under Apache license.

Alternatives cache2k does not try to be a full blown distributed enterprise caching solution. Some alternatives which you should take a look on: Google Guava Cache

EHCache

JCS

Caffeine Distributed caches: Infinispan

hazelcast

redsisson

Apache ignite