Need help with cache2k?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

506 Stars 58 Forks Apache License 2.0 2.4K Commits 9 Opened issues


Lightweight, high performance Java caching

Services available


Need anything else?

Contributors list

License Stack Overflow Maven Central

cache2k Java Caching

cache2k is an in-memory high performance Java Caching library.

  Cache cache = new Cache2kBuilder() {}
    .expireAfterWrite(5, TimeUnit.MINUTES)    // expire/refresh after 5 minutes
    .setupWith(UniversalResiliencePolicy::enable, b -> b // enable resilience policy
      .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

For a detailed introduction continue with Getting Started.

Features at a glance



For more documentation and latest news, see the cache2k homepage.


See the Contributor Guide.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.