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 .setupWith(UniversalResiliencePolicy::enable, b -> b // enable resilience policy .resilienceDuration(30, TimeUnit.SECONDS) // cope with at most 30 sec