Lightweight, high performance Java caching

Overview

License Stack Overflow Maven Central

cache2k Java Caching

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

  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 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.

Features at a glance

Integrations

  • Spring Framework
  • Scala Cache
  • Datanucleus (via JCache)
  • Hibernate (via JCache)
  • .... and probably more, please raise an issue and get it listed!

More...

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

Comments
  • Bulk Load / Loader that will use loadAll()

    Bulk Load / Loader that will use loadAll()

    Hey, is there any plan for releasing Cache implementation that would use Loader's loadAll()? It'd help me a lot with my use case, where I fetch data from HTTP endpoint which supports requests by many IDs. So for 100k objects in cache I could do 1k HTTP requests if each request would fetch 100 IDs instead of 100k requests 1 by 1.

    Expected behaviour:

    • collect all cache entries eligible to refresh and load them via single loadAll method

    A nice to have feature would be an option about the size of the batch OR time limit eg.: the batch size is 1.000, but after 2 minutes there're only 512 keys eligible to load so the cache loads all the 512 keys and reset the timer

    feature 
    opened by cybuch 36
  • Fixed-time caching, caches forever!

    Fixed-time caching, caches forever!

    Hi, I used to use Google guava cache for fixed-time caching of certain contents on a web application. After knowing about cache2k, I wrote a small facade to be able to switch between cache2k and guava, and changed my default cache framework to cache2k on a high traffic website (~100k unique users per day). I switched to cache2k for two reasons. First it's out of the box JMX support. Second I assumed that when my DB fails for any reason, and so org.cache2k.CacheSource.get(K) throws any exception, cache2k continues to return old cached values for the keys. So my website home page would continue to work even after DB gets down.

    I was satisfied with JMX support but about the second I was wrong. Please tell me if this is intended behavior that cache fails when CacheSource.get() fails.

    Well, this post is about another issue which seems to be very severe: The problem is about fixed-time caching and strong caching of cache2k. In my high traffic website fixed-time caching never refreshed after a couple of days, that is, it kept old values and did not update values every 1 minute (1 minute was my fixed caching period). The case was getting bad when I added an API to do a org.cache2k.Cache.remove(K) for failed caches so that website admin can refresh a cache himself. It works for some days but again fails after that. and Cache.remove(K) did nothing.

    Switching back to guava, everything works fine.

    bug question 
    opened by mohsen 22
  • Ensure compatibility with android

    Ensure compatibility with android

    Maybe include the animal sniffer? See: http://mojo.codehaus.org/animal-sniffer-maven-plugin/ https://jinahya.wordpress.com/2013/08/28/machine-scents/

    What else? http://stackoverflow.com/questions/24364161/checking-a-jar-for-android-compatibility-in-maven

    enhancement 
    opened by cruftex 21
  • Graal native image support

    Graal native image support

    Does cache2k support Graal native image? I tried it and ran into the following:

    Exception in thread "main" org.cache2k.CacheException: register JMX bean, ObjectName: org.cache2k:type=CacheManager,name=default
    	at org.cache2k.impl.serverSide.JmxSupport.managerCreated(JmxSupport.java:116)
    	at org.cache2k.core.CacheManagerImpl.<init>(CacheManagerImpl.java:116)
    	at org.cache2k.core.Cache2kCoreProviderImpl.getManager(Cache2kCoreProviderImpl.java:160)
    	at org.cache2k.core.Cache2kCoreProviderImpl.getManager(Cache2kCoreProviderImpl.java:135)
    	at org.cache2k.CacheManager.getInstance(CacheManager.java:93)
    	at org.cache2k.Cache2kBuilder.config(Cache2kBuilder.java:165)
    	at org.cache2k.Cache2kBuilder.disableStatistics(Cache2kBuilder.java:742)
    	at commandcenter.command.cache.InMemoryCache$.make(InMemoryCache.scala:26)
    	at commandcenter.CCRuntime.runtime(CCRuntime.scala:21)
    	at commandcenter.CCRuntime.runtime$(CCRuntime.scala:14)
    	at commandcenter.cli.Main$.runtime$lzycompute(Main.scala:12)
    	at commandcenter.cli.Main$.runtime(Main.scala:12)
    	at commandcenter.CCApp.platform(CCApp.scala:27)
    	at commandcenter.CCApp.platform$(CCApp.scala:27)
    	at commandcenter.cli.Main$.platform$lzycompute(Main.scala:12)
    	at commandcenter.cli.Main$.platform(Main.scala:12)
    	at zio.Runtime.unsafeRunAsyncCancelable(Runtime.scala:112)
    	at zio.Runtime.unsafeRunAsyncCancelable$(Runtime.scala:105)
    	at commandcenter.cli.Main$.unsafeRunAsyncCancelable(Main.scala:12)
    	at zio.Runtime.unsafeRunAsync(Runtime.scala:94)
    	at zio.Runtime.unsafeRunAsync$(Runtime.scala:93)
    	at commandcenter.cli.Main$.unsafeRunAsync(Main.scala:12)
    	at zio.Runtime.unsafeRunSync(Runtime.scala:82)
    	at zio.Runtime.unsafeRunSync$(Runtime.scala:79)
    	at commandcenter.cli.Main$.unsafeRunSync(Main.scala:12)
    	at zio.Runtime.unsafeRun(Runtime.scala:59)
    	at zio.Runtime.unsafeRun$(Runtime.scala:58)
    	at commandcenter.cli.Main$.unsafeRun(Main.scala:12)
    	at commandcenter.CCApp.main(CCApp.scala:14)
    	at commandcenter.CCApp.main$(CCApp.scala:10)
    	at commandcenter.cli.Main$.main(Main.scala:12)
    	at commandcenter.cli.Main.main(Main.scala)
    Caused by: java.lang.NullPointerException
    	at org.cache2k.impl.serverSide.JmxSupport.managerCreated(JmxSupport.java:110)
    	... 31 more
    

    I'm using cache2k in a Scala project, but I'm pretty sure that's irrelevant.

    I'm curious why this JMX error is popping up even if I explicitly set enableJmx(false). I currently only have cache2k-api and cache2k-core as dependencies. This all works fine with a normal JVM (I'm using JDK 11).

    I'm thinking this is an AOT issue with native-image. Dynamic loading and reflection can cause weird behavior for native-image if not specifically worked around. But that's just a guess. Honestly, I have no idea what JMX even is. 😛

    I can provide more information if needed, but I was just checking if Graal native-image was considered as a target in the first place.

    opened by reibitto 20
  • Allow cache disabling

    Allow cache disabling

    I am trying to temporarily disable (by disable I mean: act as if caching was turned off entirely) a set of cache2k caches and there seems to be no way to do this with the default implementation at "runtime" (and by runtime I mean after the cache has been created and potentially populated). So I thought I would provide a new Cache (possibly using the existing cache implementation along with org.cache2k.ForwardingCache and just wrapping each call to act as I would expect if disabled). Please note that I am not using any loader functionality (and would like not to).

    How do I register a new cache implementation within cache2k? Is there a better way to do this without using a loader?

    Ideally I would like to do something like this: CacheManager.getInstance().getActiveCaches().forEach(cache -> {cache.enable();}); and this CacheManager.getInstance().getActiveCaches().forEach(cache -> {cache.clear(); cache.disable();});

    Originally from discussion at StackOverlow

    feature 
    opened by DT209 17
  • Resources is not cleanup after CacheManager::close

    Resources is not cleanup after CacheManager::close

    Tested with v2.0.0, after CacheManager::close call finished, there is a thread[ForkJoinPool.commonPool-worker-n] created by cache2k remain alive for a few seconds, tomcat report such warning on shutdown. It seems HeapCache::cancelTimerJobs will not terminate timer thread immediately.

    opened by quaff 16
  • Eviction listener

    Eviction listener

    Similar to #38, it would be really useful to have an eviction listener.

    In my use-case i'm using an in-memory Cache<MyKey, File> to manage an on-disk cache of files, so whenever an entry is expired / removed / evicted from the cache I need to delete the corresponding file.

    I'm currently using caffeine but would like to try cache2k to see if it supports our access patterns better.

    feature 
    opened by ksperling 15
  • Expiry after Access / Time to Idle / Idle Scan

    Expiry after Access / Time to Idle / Idle Scan

    Support of expiry after an entry is accessed is missing in core cache2k.

    What is it?

    An entry expires and is removed from the cache after being not accessed for a period of time. The main use is primarily for freeing resources and shrinking the cache when the application is not in use.

    Current state:

    The feature is available in the JCache support. However, it is not implemented very efficiently. Also, the standard functionality of JCache is not very practicable. JCache defines TTI, however it cannot be combined with expire after write.

    Why it isn't available in cache2k, yet?

    We almost never need it. Typically we run caches with a TTL between 30 seconds and 30 minutes. Which means that entries expire via the TTL setting and the cache shrinks. TTI would be needed if entries never expire via TTL or have a higher TTL than TTI. For example a web resource might be allowed to be cached for 6 days, however, if being not accessed we like to remove it from memory after one hour.

    The second reason is the overhead. TTI is typically implemented via an LRU style linked list. This brings lock contention and concurrency issues.

    Solutions

    If needed several options are available via the existing cache2k features, e.g. the expiry can be modified in a cache request via the entry processor.

    We also plan to do an efficient implementation of a TTI approximation which is based on the eviction algorithm.

    feature 
    opened by cruftex 14
  • Generic types and type information for cache construction

    Generic types and type information for cache construction

    Although there is a special method for building caches with collections as value, the available pieces of information are not used when building the cache

    For example Cache<String, Set> userToItemCache = CacheBuilder.newCache(String.class, Set.class, SeenItem.class) .expirySecs(30 * 60) .build();

    This would return a Cache<String, Set>, although it would be much better to return a Cache<String, Set<SeenItem>.

    Maybe there can be a special buildCollectionCache() method

      public abstract <C extends Collection<T>> Cache<K, C<T>> build(Class<C> _collectionClass);
    

    which simply uses build() and casts the result accordingly? This helps to prevent boilerplate code, as it is a common use case to have Collections as values.

    opened by tburny 14
  • Fix cache2k cause tomcat cannot stop log4j thread

    Fix cache2k cause tomcat cannot stop log4j thread

    02-Jul-2019 10:39:38.637 WARN [Thread-7] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Log4j2-TF-10-AsyncLogger[DefaultAsyncContext@main]-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
     sun.misc.Unsafe.park(Native Method)
     java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
     java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
     com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(TimeoutBlockingWaitStrategy.java:38)
     com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56)
     com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:159)
     com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
     java.lang.Thread.run(Thread.java:748)
    

    I have verified this but didn't investigate why, normally we use org.slf4j.LoggerFactory.getLogger() not org.slf4j.LoggerFactory.getILoggerFactory().getLogger(). may the same applies to commons logging, org.apache.commons.logging.LogFactory.getFactory().getInstance() should be org.apache.commons.logging.LogFactory.getLog

    opened by quaff 11
  • Integer overflow when the amount of element overtakes 2^25

    Integer overflow when the amount of element overtakes 2^25

    Take a look at method cache2k-api\Hash2.java:Hash2<K,V>->calcMaxFill(), you should be noticed that there is an Integer Overflow side effect here. When the amount of element overtakes 2^24 and HeapCache.TUNABLE.hashLoadPercent value is default (64), doubling the hash table size to 2^25 causes segmentMaxFill to negative (and 0 for the latter, which causes NegativeArraySizeException) because of Integer Overflow.

    I've rebuilded your library with an adjustment for calcMaxFill method: "Math.round((float)entries.length * HeapCache.TUNABLE.hashLoadPercent / 100 / LOCK_SEGMENTS);" and it works like a charm.

    Your friend, H.B Xuyen

    bug 
    opened by detohaz 11
  • LinkageError ->  Cannot resolve cache2k core implementation

    LinkageError -> Cannot resolve cache2k core implementation

    Error

    I am trying to use the cache for the first time. But unfortunately I get the following message on the server

    15:13:11,642 ERROR [ch.coop.workflow.component.hrservices.cache.AbstractWorkforceIdKeyCache] (default task-30) Error: java.lang.LinkageError: Cannot resolve cache2k core implementation
            at org.cache2k.CacheManager.<clinit>(CacheManager.java:64)
            at org.cache2k.Cache2kBuilder.cfg(Cache2kBuilder.java:186)
            at org.cache2k.Cache2kBuilder.name(Cache2kBuilder.java:342)
            at ch.coop.workflow.component.hrservices.cache.AbstractWorkforceIdKeyCache.initCache(AbstractWorkforceIdKeyCache.java:29)
            at ch.coop.workflow.component.hrservices.cache.AbstractWorkforceIdKeyCache.getCache(AbstractWorkforceIdKeyCache.java:22)
            at ch.coop.workflow.component.hrservices.cache.MaOrgDatCache.getDocument(MaOrgDatCache.java:24)
            at ch.coop.workflow.component.hrservices.HRServicesService.zHRGetMitarbeiterOrgDat(HRServicesService.java:173)
    

    Setting

    • SLES 12
    • Adobe AEM J2EE Forms 6.5
    • JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14)
    • Java 1.8
    • Maven 3.6.3
    • Eclipse IDE

    pom.xml

    <properties>
    	<jdk-version>1.8</jdk-version>
    	<cache2k-version>2.6.1.Final</cache2k-version>
    </properties>
    <dependencies>
    	<!-- CACHE -->
    	<dependency>
    		<groupId>org.cache2k</groupId>
    		<artifactId>cache2k-api</artifactId>
    		<version>${cache2k-version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.cache2k</groupId>
    		<artifactId>cache2k-core</artifactId>
    		<version>${cache2k-version}</version>
    		<scope>runtime</scope>
    	</dependency>
    </dependencies>
    

    implementation

    package ch.coop.workflow.component.hrservices.cache;
    
    import java.util.concurrent.TimeUnit;
    
    import org.cache2k.Cache;
    import org.cache2k.Cache2kBuilder;
    import org.cache2k.io.CacheLoader;
    import org.w3c.dom.Document;
    
    import ch.coop.workflow.component.hrservices.cache.functions.WorkforceIdKeyFunction;
    import ch.coop.workflow.component.hrservices.cache.keys.WorkforceIdKey;
    
    public abstract class AbstractWorkforceIdKeyCache {
    
    	protected AbstractWorkforceIdKeyCache() {
    	}
    
    	protected static Cache<WorkforceIdKey, Document> getCache(WorkforceIdKeyFunction fn, String cacheName) {
    		return initCache(fn, cacheName);
    	}
    
    	private static Cache<WorkforceIdKey, Document> initCache(WorkforceIdKeyFunction fn, String cacheName) {
    		return new Cache2kBuilder<WorkforceIdKey, Document>() {
    		}
    				.name(cacheName)
    				.entryCapacity(1000)
    				.refreshAhead(true)
    				.loaderThreadCount(3)
    				.expireAfterWrite(60, TimeUnit.MINUTES)
    				.loader(new CacheLoader<WorkforceIdKey, Document>() {
    
    					@Override
    					public Document load(WorkforceIdKey key) throws Exception {
    						return fn.reload(key);
    					}
    
    				})
    				.build();
    	}
    }
    
    package ch.coop.workflow.component.hrservices.cache;
    
    import org.apache.log4j.Logger;
    import org.cache2k.Cache;
    import org.w3c.dom.Document;
    
    import ch.coop.workflow.common.exception.SystemException;
    import ch.coop.workflow.component.hrservices.cache.keys.WorkforceIdKey;
    import ch.coop.workflow.component.hrservices.dao.SAPModuleDAO;
    
    public class MaOrgDatCache extends AbstractWorkforceIdKeyCache {
    
    	private static final Logger LOGGER = Logger.getLogger(MaOrgDatCache.class);
    
    	private static SAPModuleDAO sapDAO;
    	private static Cache<WorkforceIdKey, Document> cache;
    
    	private MaOrgDatCache() {
    	}
    
    	public static Document getDocument(WorkforceIdKey key, SAPModuleDAO service) {
    		sapDAO = service;
    		if (cache == null) {
    			cache = getCache(MaOrgDatCache::reload, "MaOrgDatCache");
    		}
    		try {
    			return cache.get(key);
    		} catch (Exception e) {
    			String message = String.format("error loading Z_HR_GET_MITARBEITER_ORG_DAT with %s", key);
    			LOGGER.error(message, e);
    			throw new SystemException(message);
    		}
    	}
    
    	protected static Document reload(WorkforceIdKey key) {
    		Document doc = sapDAO.zHRGetMitarbeiterOrgDat(key.getXmlDate(), key.getWorkforceId());
    		if (doc == null) {
    			String message = "document is null";
    			throw new SystemException(message);
    		}
    		return doc;
    	}
    }
    

    I do not get any error in Eclipse during execution of the test cases. Do I need to implement/use the cache differently?

    opened by puppetmaster- 2
  • Cache do not update per second one day

    Cache do not update per second one day

    Cache do not update per second one day, and there no thread name starts with cache2k-loader-

    static Cache<String, LocalDateTime> TIME_CACHE = new Cache2kBuilder<String, LocalDateTime>() {
        }.refreshAheadPolicy(new AutoRefreshPolicy<>())
                .expireAfterWrite(1, TimeUnit.SECONDS)
                .loader((key) -> LocalDateTime.now())
                .build();
    
    opened by javalover123 18
  • Bump spring-core from 5.3.18 to 5.3.20 in /cache2k-spring

    Bump spring-core from 5.3.18 to 5.3.20 in /cache2k-spring

    Bumps spring-core from 5.3.18 to 5.3.20.

    Release notes

    Sourced from spring-core's releases.

    v5.3.20

    :star: New Features

    • Refine CachedIntrospectionResults property introspection #28445
    • Improve tests and Javadoc on binding to a property of type javax.servlet.Part #27830
    • WritableResource doesn't have parity with Resource in @Value etc. [SPR-10656] #15284

    :lady_beetle: Bug Fixes

    • Ignore invalid STOMP frame #28443
    • @ModelAttribute name attribute is not supported in WebFlux #28423
    • Fix BindingResult error when ModelAttribute has custom name in WebFlux #28422
    • Request body deserialization failures are not captured by exception handlers in WebFlux #28155

    :notebook_with_decorative_cover: Documentation

    • Remove Log4J initialization from package-info.java in spring-web #28420
    • Remove Log4J configurer from package-info.java in spring-core #28411
    • Fix github issue reference in RequestMappingHandlerMapping #28372
    • Add Javadoc since tags for GraphQL constants #28369
    • Fix method reference in Kotlin documentation #28340

    :hammer: Dependency Upgrades

    • Upgrade to ASM 9.3 #28390
    • Upgrade to Reactor 2020.0.19 #28437

    :heart: Contributors

    We'd like to thank all the contributors who worked on this release!

    v5.3.19

    :star: New Features

    • Remove DNS lookups during websocket connection initiation #28280
    • Add application/graphql+json Media type and MIME type constants #28271
    • Fix debug log for no matching acceptableTypes #28116
    • Provide support for post-processing a LocalValidatorFactoryBean's validator Configuration without requiring sub-classing #27956

    :lady_beetle: Bug Fixes

    ... (truncated)

    Commits
    • e0f56e7 Release v5.3.20
    • 83186b6 Refine CachedIntrospectionResults property introspection
    • dc2947c Ignore invalid connect frame
    • e4ec376 Disabling Undertow server in CoroutinesIntegrationTests
    • c81e11d Polishing
    • de6180b Upgrade to Reactor 2020.0.19
    • 1c10cdd Update copyright dates
    • 941b92c Make inner classes static when feasible
    • e26d883 Stop referring to features as Java 6/7 features where unnecessary
    • a1c7380 Add test for value attribute in @​ModelAttribute in WebFlux
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Multiple @Nullable annotations

    Multiple @Nullable annotations

    Thank you for this gem of a cache manager. We are thoroughly enjoying the project.

    Is it possible for cache2k to stop exporting its annotations, at least limit exports to the cache2k project, as in exports to org.cache2k.hierarchy? We find ourselves creating exception rules for the java IDE to not propose those classes as auto-complete candidates.

    Thank you!

    Improvement 
    opened by a1730 4
  • Central programmatic configuration

    Central programmatic configuration

    cache2k has no standard way of a central programmatic configuration at the moment.

    The Spring support of cache2k allows that, e.g.:

     @Bean
     ​public CacheManager cacheManager() {
       ​return new SpringCache2kCacheManager()
         ​.defaultSetup(b->b.entryCapacity(2000))
         ​.addCaches(
           ​b->b.name("countries"),
           ​b->b.name("test1").expireAfterWrite(30, TimeUnit.SECONDS).entryCapacity(10000),
           ​b->b.name("anotherCache").entryCapacity(1000)).permitNullValues(true);
     }
    

    A similar scheme would be great for the org.cache2k.CacheManager. Requirements:

    • A org.cache2k.CacheManager can live within a DI container and is accepting programmatic configuration per cache, addressed by cache name
    • This is an alternative for a central cache configuration via XML
    • In contrast to the Spring approach, where cache instances are created with the SpringCache2kCacheManager creation, the mechanism should only contain the configuration, which is before or after (?) the cache is build when the code uses it
    • In the long run this replaces the separate SpringCache2kCacheManager configuration approach
    • This plays well with the customizer interfaces used by Spring, so a Cache2kCacheManagerCustomizer becomes useful with this ability
    • If no DI container is used, it needs to be ensured that the central programmatic configuration is run first and populates the cache manager. This could be done via the serviceloader by declaring it as a Cache2kExtensionProvider
    feature Spring 
    opened by cruftex 0
Releases(v2.6.1.Final)
  • v2.6.1.Final(Feb 7, 2022)

    This change log lists the changes since 2.6.0.Final.

    Fixes and Improvements

    • Timer: Reduce scheduler events
    • Timer: Correct scheduling time if an earlier expiry is inserted. Maximum lag time criteria was not met in this case.
    • Timer: Rare case if only one cache entry with TTL and regular updates is used, leeds to continuous increase of scheduling events

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.6.1.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.6.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    def cache2kVersion = '2.6.1.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.6.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.6.1.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v2.6.0.Final(Feb 1, 2022)

    This change log lists the changes since 2.4.1.Final.

    New and Noteworthy

    • Idle scan: an efficient expire after access / time to idle alternative, Github issue #39
    • Lots of cleanup and housekeeping with some minor changes possibly breaking compatibility
    • Test coverage improvement and removal of unused code
    • Cache disable support, Github issue #74
    • Continuous Android testing

    Updated benchmarks comparing with Caffeine 3.0.5, and EHCache3 3.9.6

    Possible breakages

    Changes that may break existing applications.

    • Spring support: SpringCache2kManager.defaultSetup throws IllegalStateException if not called before caches are added
    • Spring support: SpringCache2kManager.defaultSetup throws IllegalStateException if called twice
    • EXPIRY_NOT_ETERNAL constant removed from Cache2kConfig
    • Fixed generic typing issues in org.cache2k.config package
    • Sechduler.schedule uses delay duration instead of absolute time
    • TimeReference.millis() renamed to ticks() and additional conversion methods to support other time resolutions than milliseconds
    • Safety gap system property for sharp timeout changed to: org.cache2k.sharpExpirySafetyGapMillis
    • Removed capability to modify internal constants via Tunable
    • removed SpringCache2kCacheManager.setCaches(Collection<Cache2kConfig<?, ?>> cacheConfigurationList)
    • Corrected signature BulkCacheLoader.BulkCallback.onLoadFailure(Set, Exception) to onLoadFailure(Iterable, Exception)
    • Cache.expireAt() and MutableCacheEntry.setExpiryTime(): the maximum expiry time is capped by the specified expireAfterWriteDuration, this aligns the behavior with the ExpiryPolicy. The rationale is, that an (application) user, when setting expireAfterWrite expects that this duration is never exceeded.

    API Changes

    • Added CacheClosedException
    • Added CacheEventListenerException

    Fixes and Improvements

    • Eviction improvements, minimal change to improve eviction, See issue comment
    • eternal(true/false) / MutableEntry.setExpiryTime: Expiry can be modified, although no other expiry setting is present, or in other words: the timer support is available by default. If eternal(true) is configured, timer support is disabled and Cache.invoke / MutableEntry.setExpiryTime or Cache.expireAt cannot be used
    • Cache.invoke / MutableEntry.setExpiryTime: has no effect if entry is not existing
    • Cache.invoke / MutableEntry.getExpiryTime always returns positive time value
    • CI tests with Android API level 26 and API level 30
    • Expiry timer: handle time values close up to Long.MAX_VALUE - 1 without overflow
    • Support Duration for duration parameters in the Cache2kBuilder
    • Config section InternalConfig in cache2k-core for specific tuning values that should not be exposed in the public API
    • Spring support: SpringCache2kManager.setDefaultCacheNames() added
    • Spring support: SpringCache2kManager.addCache(String, Function)
    • Spring support: SpringCache2kCacheManager.getCache aligned with interface contract: returns null if unknown cache name is requested
    • CacheClosedListener: Wait for CompletableFuture
    • Simplify integrity checking, remove integrity state from toString output
    • API: add/correct @Nullable annotations in ExpiryPolicy and AsyncCacheLoader
    • Cache.invoke: Set expiry time correctly for exception propagation, in case setException and setExpiry is used atomically
    • CacheInfo.getExpiryAfterWriteTicks, CacheInfo.getTimeReference(): added
    • CacheControl.getCapacityLimit returns maximum weight correctly when weigher is present
    • JCache: simplify implementation with access expiry and Cache.getAll
    • JCache: Corrected access expiry handling for Cache.invoke / Cache.invokeAll

    Non Functional Improvements

    • Some tests migrated to JUnit 5 and AspectJ
    • Various documentation touch ups
    • Documentation and examples for expiry and expiry policy
    • Examples for expiry policy in ExpiryPolicyExampleTest unit test
    • Documentation improvements, fixed many typos and grammar errors in the API package

    Credits

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.6.0.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.6.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    def cache2kVersion = '2.6.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.6.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.6.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v2.5.3.Beta(Jan 24, 2022)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Cogee Beach" - 2.6.0.Final.

    API Change

    • Added CacheClosedException, moved from org.cache2k.core

    Fixes and Improvements

    • CacheClosedListener: Wait for CompletableFuture
    • Simplify integrity checking, remove integrity state from toString output
    • API: add/correct @Nullable annotations in ExpiryPolicy and AsyncCacheLoader
    • Cache.invoke: Set expiry time correctly for exception propagation, in case setException and setExpiry is used atomically
    • CacheInfo.getExpiryAfterWriteTicks, CacheInfo.getTimeReference(): added

    Possible breakages

    • Cache.expireAt() and MutableCacheEntry.setExpiryTime(): the maximum expiry time is capped by the specified expireAfterWriteDuration, this aligns the behavior with the ExpiryPolicy. The rationale is, that an (application) user, when setting expireAfterWrite expects that this duration is never exceeded.
    • CacheControl.getCapacityLimit returns maximum weight correctly when weigher is present
    Source code(tar.gz)
    Source code(zip)
  • v2.5.2.Alpha(Jan 17, 2022)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Cogee Beach" - 2.6.0.Final.

    Fixes and Improvements

    • eternal(true/false) / MutableEntry.setExpiryTime: Expiry can be modified, although no other expiry setting is present, or in other words: the timer support is available by default. If eternal(true) is configured, timer support is disabled and Cache.invoke / MutableEntry.setExpiryTime or Cache.expireAt cannot be used
    • Cache.invoke / MutableEntry.setExpiryTime: has no effect if entry is not existing
    • Cache.invoke / MutableEntry.getExpiryTime always returns positive time value
    • CI tests with Android API level 26 and API level 30
    • Expiry: handle time values close to Long.MAX_VALUE without overflow, although the application should not produce these.
    • Support Duration for duration parameters in the Cache2kBuilder
    • Config section InternalConfig in cache2k-core for specific tuning values that should not be exposed in the public API
    • Spring support: SpringCache2kDefaultSupplier provides default setup and manager context
    • Spring support: SpringCache2kManager.setDefaultCacheNames() added
    • Spring support: SpringCache2kManager.addCache(String, Function)
    • Spring support: added SpringCache2kDefaultCustomizer
    • Corrected signature BulkCacheLoader.BulkCallback.onLoadFailure(Set, Exception) to onLoadFailure(Iterable, Exception)

    Possible breakages

    Changes that may break existing applications.

    • Spring support: SpringCache2kManager.defaultSetup throws IllegalStateException if not called before caches are added
    • EXPIRY_NOT_ETERNAL constant removed from Cache2kConfig
    • Fixed generic typing issues in org.cache2k.config package
    • Sechduler.schedule uses delay duration instead of absolute time
    • TimeReference.millis() renamed to ticks() and additional conversion methods to support
    • other time resolutions than milliseconds
    • Safety gap system property for sharp timeout changed to: org.cache2k.sharpExpirySafetyGapMillis
    • Removed capability to modify internal constants via Tunable
    • removed SpringCache2kCacheManager.setCaches(Collection<Cache2kConfig<?, ?>> cacheConfigurationList)

    Non Functional Improvements

    • Started with tests based on JUnit 5
    • Documentation and examples for expiry, expiry policy
    • Documentation improvements, fixed many typos and grammar errors in the API package

    Credits

    Source code(tar.gz)
    Source code(zip)
  • v2.5.1.Alpha(Nov 23, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Cogee Beach" - 2.6.0.Final.

    Fixes and Improvements

    • Documentation touch ups
    • Cache disable support, Github issue #74
    • Eviction improvements, minimal change to improve eviction, See issue comment
    • Examples for expiry policy in ExpiryPolicyExampleTest unit test
    • Idle scan: a more efficient expire after access / time to idle alternative, Github issue #39
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1.Final(Oct 28, 2021)

    This change log lists the changes since 2.4.0.Final.

    Fixes and Improvements

    • Improve exception handling when async callbacks are completed after the cache is closed, GH#175
    • Fix wrong links to the documentation

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.4.1.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.4.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    def cache2kVersion = '2.4.1.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.4.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.4.1.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v2.4.0.Final(Oct 25, 2021)

    This change log lists the changes since 2.2.1.Final.

    New and Noteworthy

    This targets details to improve performance of big caches in multi core environments and minimizing the CPU impact on monitoring and frequent statistic polls.

    Updated benchmarks comparing with Caffeine 3.0.4, and EHCache3 3.9.6

    Fixes and Improvements

    • Change default entry capacity to 1802. When the capacity is reported to a monitoring system or otherwise analysed, this serves as a magic number to indicate that the cache capacity is essentially not configured intentionally
    • Improved hit counter accuracy for statistics, see: https://github.com/cache2k/cache2k/issues/150
    • Improved statistics retrieval. When requesting the statistics, e.g. for micrometer export, no expensive operations are performed any more and no cache wide locking is done. In consequence statistics can be retrieved more frequently without big effect on the running application. Since there is no cache wide lock, statistics counters can have inconsistencies, e.g. the inserted and removed entries might not match exactly with the current size.
    • Eviction throughput improvement. The Clock-Pro ghost/history table is limited to 3K entries. Profiling showed that the big ghost table attributed to lower performance with bigger cache sizes (1 million entries) and did not contribute significantly to a better hitrate.
    • Various code quality improvements

    API Breakages

    • MutableCacheEntry.getValueOrNull: removed, since wrongly introduced in version 2.0.

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.4.0.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.4.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    def cache2kVersion = '2.4.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.4.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.4.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: [JCache - cache2k User Guide](https://cache2k.org/docs/latest/user-guide.html#jcache

    Source code(tar.gz)
    Source code(zip)
  • v2.3.1.Alpha(Sep 16, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Port Philip" - 2.4.0.Final.

    Fixes and Improvements

    • Improved hit counter accuracy for statistics, see: https://github.com/cache2k/cache2k/issues/150
    • Improved statistics retrieval. When requesting the statistics, e.g. for micrometer export, no expensive operations are performed any more and no cache wide locking is done. In consequence statistics can be retrieved more frequently without big effect on the running application. Since there is no cache wide lock, statistics counters can have inconsistencies, e.g. the inserted and removed entries might not match exactly with the current size.
    • Eviction throughput improvement. The Clock-Pro ghost/history table is limited to 3K entries. Profiling showed that the big ghost table attributed to lower performance with bigger cache sizes (1 million entries) and did not contribute significantly to a better hitrate.
    • Various code quality improvements
    Source code(tar.gz)
    Source code(zip)
  • v2.2.1.Final(Aug 11, 2021)

    This change log lists the changes since 2.2.0.Final.

    Fixes and Improvements

    • Cache.entries: throws IlliegalStateException if remove is called twice on the iterator.
    • Cache.asMap: aligned to the map contract, equals, hashCode cooperate with arbitrary maps, toString is implemented identical to Java maps (e.g. HashMap)

    Credits

    Many thanks for the valuable input to the contributors of this release:

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.2.1.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.2.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '2.2.1.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.2.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.2.1.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: [JCache - cache2k User Guide](https://cache2k.org/docs/latest/user-guide.html#jcache

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0.Final(Aug 10, 2021)

    This change log lists the complete changes since the last stable version 2.0.0.Final.

    New and Noteworthy

    • Bulk support: New interfaces BulkCacheLoader and AsyncBulkCacheLoader which are used by the cache operations getAll, loadAll, reloadAll and invokeAll. The will get more optimizations and improvements in the next development releases. GH#166
    • CoalescingBulkLoader: combines multiple requests into a bulk requests or limits bulk requests to a maximum size. Recommended when using a bulk loader and refresh ahead. The CoalescingBulkLoader resides in the separate jar cache2k-addon.

    Possible Breakages

    Deprecated methods were removed (see below).

    API changes

    • Improve API of Feature
    • Async loader: add cache to the load context
    • Remove deprecated org.cache2k.integration package
    • Remove deprecated methods Cache.loadAll, Cache.reloadAll with CacheOperationCompletionListener
    • Remove deprecated classes AdvancedKeyValueSource, KeyValueStore
    • The deprecation flag for expireAt is removed. We keep this method
    • Remove unused org.cache2k.spi.Cache2kExtensionProvider

    Fixes and Improvements

    • cache2k-api / Modules: export org.cache2k.annotation for Nullable etc. Improved new bulk loader support.
    • Improve entry processor performance, GH#170
    • Consistent exception handling for Cache.computeIfAbsent, GH#171
    • Support for AutoClosable for async loaders
    • Cache.asMap(): Align exception handling computeIfPresent, compute with ConcurrentMap contract

    Credits

    Many thanks for the valuable input to the contributors of this release:

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-api</artifactId>
          <version>2.2.0.Final</version>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>2.2.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '2.2.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.2.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.2.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: [JCache - cache2k User Guide](https://cache2k.org/docs/latest/user-guide.html#jcache

    Source code(tar.gz)
    Source code(zip)
  • v2.1.5.Beta(Aug 5, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Twofold Bay" - 2.2.0.Final.

    Fixes and Improvements

    Improved new bulk loader support.

    • AsyncBulkCacheLoader.BulkCallback: New methods onLoadFailure(key, exception) and onLoadFailure(keys, exception)
    • CoalescingBulkLoader: Fix/improve concurrency and exception handling
    Source code(tar.gz)
    Source code(zip)
  • v2.1.4.Beta(Aug 3, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Twofold Bay" - 2.2.0.Final.

    API changes

    Remove deprecated API elements:

    • org.cache2k.integration package
    • Cache.loadAll, Cache.reloadAll with CacheOperationCompletionListener
    • AdvancedKeyValueSource, KeyValueStore
    Source code(tar.gz)
    Source code(zip)
  • v2.1.3.Alpha(Jul 22, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Twofold Bay" - 2.2.0.Final.

    New and Noteworthy

    • Update bulk support: improve API, ensure basic functionality, concurrency tests, see GH#166

    Fixes and Improvements

    • Configuration of CoalescingBulkLoader
    • Improve API of Feature
    • Fix failure callback in bulk loader processing
    • Documentation
    • Async loader: add cache to the load context
    Source code(tar.gz)
    Source code(zip)
  • v2.1.2.Alpha(Mar 25, 2021)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Twofold Bay" - 2.2.0.Final.

    New and Noteworthy

    • Update bulk support: improve API, ensure basic functionality, concurrency tests, see GH#166

    Fixes and Improvements

    • Improve interface for bulk support
    • Improve entry processor performance, GH#170
    • Consistent exception handling for Cache.computeIfAbsent, GH#171
    • Support for AutoClosable for async loaders
    • Cache.asMap(): Align exception handling computeIfPresent, compute with ConcurrentMap contract

    Credits

    Many thanks to the contributors of this release:

    Source code(tar.gz)
    Source code(zip)
  • v2.1.1.Alpha(Dec 24, 2020)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Twofold Bay" - 2.2.0.Final.

    New and Noteworthy

    • Bulk support: New interfaces BulkCacheLoader and AsyncBulkCacheLoader which are used by the cache operations getAll, loadAll, reloadAll and invokeAll. The will get more optimizations and improvements in the next development releases. GH#166

    Fixes and Improvements

    • cache2k-api / Modules: export org.cache2k.annotation for Nullable etc.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0.Final(Dec 15, 2020)

    This change log lists the changes since the last stable version 1.6.0.Final.

    Upgrading from version 1

    Version 2 has breaking changes. Recompilation is required. Most code will run with minor or no modifications. Common used functionality was kept or will be replaced gradually via deprecation. Deprecated elements may be removed in a version 2 minor release. Asses your code and change deprecated usages to the suggested alternative to be compatible with future releases.

    Major changes:

    • Requires at least Java 8 to run
    • JMX and XML configuration support is no longer part of cache2k-core
    • No caching of exceptions by default. This has to be enabled explicitly by specifying ResiliencePolicy. Previous default resilience available as UniversalResiliencePolicy in cache2k-addon

    New and Noteworthy

    cache2k now requires at least Java 8. This release focusses on API cleanup and touch ups with adaptions to available Java 8 concepts (e.g. CompletableFuture or Duration). No major functionality was added.

    • cache2k-api, cache2k-core, cache2k-jmx and cache2k-config are fully modularized
    • Requires at least Java 8 to run
    • Adaptions to Java 8 on API level. E.g. use of Duration in the configuration
    • New interfaces for CacheLoader and CacheWriter in package org.cache2k.io
    • Removal of deprecated classes and methods
    • JMX and XML configuration support is no longer part of cache2k-core
    • OSGi support with cache2k-osgi-all removed, see: GH#83
    • @Nullable annotations with Kotlin native type support
    • General scheme to enable extra functionality (Feature), used for JMX and Micrometer support
    • No caching of exceptions by default. This has to be enabled explicitly by specifying ResiliencePolicy. Previous default resilience available as UniversalResiliencePolicy in cache2k-addon
    • Configuration: Functionality can be bundled in features and can augment the configuration and wrap the cache instance.

    Possible Breakages

    Since this is a major release, some rarely used things in the API are changed without backwards compatibility. Most code is supposed to run without breaking.

    • Requires at least Java 8 to run
    • Remove deprecated classes and methods: Cache.prefetch, Cache.prefetchAll, IntCache, LongCache, CacheEntry.getLastModification, AbstractCacheEntry
    • Incompatible change of CustomizationSupplier interface
    • org.cache2k.integration.ResiliencePolicy removed. Replaced by: org.cache2k.io.ResiliencePolicy
    • JMX support moved from cache2k-core to cache2k-jmx to minimize module dependencies
    • XML configuration moved from cache2k-core to cache2k-config to minimize module dependencies
    • Dropped apache commons logging support. Commons logging seems to be not maintained any more and lacks Jigsaw/module support.
    • Drop support for XML configuration on Android, removed XML pull dependency (The Android will be potentially unsupported in cache2k V2 at first)
    • Moved JCache configuration classes in org.cache.jcache from cache2k-api to cache2k-jcache. If these are used, cache2k-jcache needs to be in compile scope.
    • Cache2kConfiguration: Changed all parameters of type long, representing milliseconds to type Duration
    • Remove deprecated classes and methods: Cache.prefetch, Cache.prefetchAll, IntCache, LongCache,, CacheEntry.getLastModification, AbstractCacheEntry
    • Cache.getStatistics removed. Replaced by CacheManagement.of(Cache).sampleStatistics().
    • Cache.clearAndClose removed. Replaced by CacheManagement.destroy
    • Removed deprecated MutableCacheEntry.getCurrentTime, replaced with getStartTime
    • Remove MutableCacheEntry.wasExisting and MutableCacheEntry.getOldValue
    • Rename MutableCacheEntry.getRefreshedTime to getModificationTime
    • MutableCacheEntry.exists: Does not change the value after setValue or triggered load
    • MutableCacheEntry.getValue: Does not change the value after setValue
    • Every class with Configuration shortened to Config and consequently changed the package name org.cache2k.configuration to org.cache2k.config.
    • Cache2kBuilder.toConfiguration() renamed to config()
    • Lots restructuring around the extra configuration sections and customizations
    • remove Cache2kBuilder.enableJmx. Replaced with Cache2kBuilder.enable(JmxSupport.class)
    • Cache.requestInterface throws UnsupportedOperationException if the requested interface is not supported instead of null
    • Change in special expiry values semantics: ExpiryTimeValues.NO_CACHE removed. ExpiryTimeValues.NOW does not start a refresh and expire immediately. ExpiryTimeValues.REFRESH does expire and start a refresh if refresh ahead is enabled.
    • No caching of exceptions by default. This has to be enabled explicitly by specifying ResiliencePolicy. Previous default resilience available as UniversalResiliencePolicy in cache2k-addon
    • Move Weigher to package org.cache2k.operation.
    • Rename MutableCacheEntry.reload to MutableCacheEntry.load
    • Remove Cache2kBuilder.enableJmx

    API Changes

    • org.cache2k.integration.CacheLoader and everything in package org.cache2k.integration is deprecated. Replacements are available in org.cache2k.io. This major change was done to change from abstract classes to interface. The new package was introduced for smoother transition to keep the previous classes and deprecated them.
    • Move TimeReference to org.cache2k.operation and also make Scheduler available
    • Cache2kBuilder: New methods setup and enable
    • New method: Cache.computeIfAbsent with function
    • New methods Cache.loadAll and Cache.reloadAll which return CompletableFuture Old methods which use CacheOperationCompletionListener are deprecated
    • New methods: Cache.mutate, Cache.mutateAll for a mutation only entry processor variant
    • Cache.entries and Cache.keys return a Set for iteration and stream support
    • New method CacheEntry.getExceptionInfo()
    • org.cache2k.jmx, API for JMX MXBeans removed
    • New interfaces CacheOperation, CacheControl and CacheInfo in org.cache2k.operation
    • New method: MutableCacheEntry.getExpiryTime()
    • New method: MutableCacheEntry.setExpiryTime()
    • New method: MutableCacheEntry.lock
    • Lots of generic typing refinements
    • Allow listeners to throw a checked exception
    • @Nullable, @NonNull annotations
    • Deprecated AdvancedKeyValueSource and KeyValueStore

    Fixes and Improvements

    • All cache customizations (e.g. CacheLoader) implement Customization.
    • Speedup of internal hash table, because compatibility for Java 6 could be removed
    • Cache.loadAll() and Cache.reloadAll() complete with exception if a a loader exception happened. If more than one exception happened the one is propagated.
    • Improved interface of ExceptionPropagator and LoadExceptionInfo
    • Cache.invoke, EntryProcessor: Make expiry calculations and listeners calls more consistent if expiry event races with the start of the operation
    • MutableCacheEntry.lock allows to lock an entry for mutation explicitly
    • Cache.asMap / ConcurrentMap implementation implements compute methods and runs them only once
    • Introduced ConfigAugmenter which can make changed to the configuration before a cache is build
    • Cache2kBuilder: Methods setup, apply allow to execute a function on the configuration or builder, which can be used to factor out configuration fragments. We use this to provide enable and disable methods on policies.
    • AdvancedCacheLoader, AsyncCacheLoader and ExpiryPolicy get null if current entry carries exception, https://github.com/cache2k/cache2k/issues/163
    • Remove ServiceLoader in modules cache2k-jmx and cache2k-micrometer
    • Introduce concept of CacheFeature and ToggleCacheFeature
    • CacheType: immutable instead of bean. CacheType.of moved from CacheTypeCapture
    • Remove the need of serializable from the configuration objects, by doing a deep copy of the default configuration via bean setters and getters.
    • Cache2kConfig: Make setEternal a separate flag. Remove logic from setters, so we can use setters and getter to copy the object
    • Ignore entryCapacity setting in case a weigher is specified
    • Cap suppression or caching of exceptions determined by ResiliencePolicy to the expireAfterWrite duration, if specified
    • Fix site build for Java 11
    • Documentation touch ups
    • Change configuration XML schema to version 2 and archive version 1
    • Spring cache manager applies default setup also to dynamically created caches that are retrieved via getCache

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

       ​<properties>
         ​<cache2k-version>2.0.0.Final</cache2k-version>
       ​</properties>
       ​<dependency>
         ​<groupId>org.cache2k</groupId>
         ​<artifactId>cache2k-api</artifactId>
         ​<version>${cache2k-version}</version>
       ​</dependency>
       ​<dependency>
         ​<groupId>org.cache2k</groupId>
         ​<artifactId>cache2k-core</artifactId>
         ​<version>${cache2k-version}</version>
         ​<scope>runtime</scope>
       ​</dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '2.0.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    For the first steps look at Getting Started - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>2.0.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:2.0.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v1.9.6.Beta(Dec 15, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    Fixes and Improvements

    • Documentation updates
    • Spring cache manager applies default setup also to dynamically created caches that are retrieved via getCache.
    Source code(tar.gz)
    Source code(zip)
  • v1.9.5.Beta(Dec 11, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    New and Noteworthy

    • Documentation fixes. This is the release candidate 2 of cache2k version 2.0

    API Changes Possible Breakages

    • Move Weigher to package org.cache2k.operation.

    Fixes and Improvements

    • Fix site build for Java 11
    • Documentation touch ups
    • Change configuration XML schema to version 2 and archive version 1
    • Event listeners will be send the wrapped cache
    Source code(tar.gz)
    Source code(zip)
  • v1.9.4.Beta(Dec 7, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    New and Noteworthy

    • Last set of API changes. This is the release candidate 1 of cache2k version 2.0

    Possible Breakages

    • N/A

    API Changes Possible Breakages

    • Customizations can implement AutoCloseable, changed from Closeable, Java 8 improvement
    • Cache and CacheManager implements AutoCloseable, changed from Closeable, Java 8 improvement
    • Scheduler and TimeReference available in base configuration and API

    Fixes and Improvements

    • Common timer threads are destroyed when last cache is closed, []GH#167](https://github.com/cache2k/cache2k/issues/167), Thanks Jingxiao Gu / @dawnwords for reporting!
    • Corner case: Don't drop a altered default name after all cache managers are closed
    Source code(tar.gz)
    Source code(zip)
  • v1.9.3.Alpha(Nov 28, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    New and Noteworthy

    • Update to enhance compatibility of client code between version 1.6 with 2.0 of cache2k

    API Changes / Possible Breakages

    • Within alpha: Un deprecate KeyValueSource, that's simple and useful
    • Drop ExpiryTimeValues.NO_CACHE. ExpiryTimeValues.NOW which has a value of 0 means no caching, and does not start a refresh. Introduced ExpiryTimeValues.REFRESH again, sinc logically everything between 0 (exclusive) and the current time, expires and starts a refresh, if refresh ahead is enabled.
    • Within alpha: Reverse hierarchy for new CacheLoaderException, which enhanced compatibility with code doing an instanceof

    Fixes and Improvements

    • Cap suppression or caching of exceptions determined by ResiliencePolicy to the expireAfterWrite duration, if specified
    Source code(tar.gz)
    Source code(zip)
  • v1.9.2.Alpha(Nov 23, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    New and Noteworthy

    • @Nullable annotations
    • General scheme to enable extra functionality, used for JMX and Micrometer support
    • No caching of exceptions by default. This has to be enabled explicitly by specifying ResiliencePolicy. Previous default resilience available as UniversalResiliencePolicy in cache2k-addon

    Possible Breakages

    Since this is a major release, some rarely used things in the API are changed without backwards compatibility. Most code is supposed to run without breaking.

    • Cache.getStatistics removed. Replaced by CacheManagement.of(Cache).sampleStatistics().
    • Cache.clearAndClose removed. Replaced by CacheManagement.destroy
    • Removed deprecated MutableCacheEntry.getCurrentTime, replaced with getStartTime
    • Remove MutableCacheEntry.wasExisting and MutableCacheEntry.getOldValue
    • Rename MutableCacheEntry.getRefreshedTime to getModificationTime
    • MutableCacheEntry.exists: Does not change the value after setValue or triggered load
    • MutableCacheEntry.getValue: Does not change the value after setValue
    • Every class with Configuration shortened to Config and consequently changed the package name org.cache2k.configuration to org.cache2k.config.
    • Cache2kBuilder.toConfiguration() renamed to config()
    • Lots restructuring around the extra configuration sections and customizations
    • remove Cache2kBuilder.enableJmx. Replaced with Cache2kBuilder.enable(JmxSupport.class)
    • Cache.requestInterface throws UnsupportedOperationException if the requested interface is not supported instead of null
    • Change in special expiry values semantics: Remove ExpiryTimeValues.REFRESH. ExpiryTimeValues.NOW expires and starts a refresh if refresh ahead is enabled. ExpiryTimeValues.NO_CACHE expires and starts no refresh.
    • No caching of exceptions by default. This has to be enabled explicitly by specifying ResiliencePolicy. Previous default resilience available as UniversalResiliencePolicy in cache2k-addon

    API Changes

    • Renamed ExceptionInformation to LoadExceptionInfo
    • New method CacheEntry.getExceptionInfo()
    • org.cache2k.jmx, API for JMX MXBeans removed
    • New interfaces CacheManagement, CacheControl and CacheInfo in org.cache2k.management
    • New method: MutableCacheEntry.lock
    • Rename MutableCacheEntry.reload to MutableCacheEntry.load
    • Remove TimeReference interface from public API and make that local to cache2k-core
    • New method: MutableCacheEntry.getExpiryTime()
    • Remove Cache2kBuilder.enableJmx
    • Cache2kBuilder: New methods `set
    • New methods: Cache.mutate, Cache.mutateAll

    Fixes and Improvements

    • Cache.loadAll() and Cache.reloadAll() complete with exception if a a loader exception happened. If more than one exception happened the one is propagated.
    • Improved interface of ExceptionPropagator and LoadExceptionInfo, A CacheEntry may be cast to LoadExceptionInfo if an exception is present
    • Cache.invoke, EntryProcessor: Make expiry calculations and listeners calls more consistent if expiry event races with the start of the operation
    • MutableCacheEntry.lock allows to lock an entry for mutation explicitly
    • Cache.asMap / ConcurrentMap implementation implements compute methods and runs them only once
    • Introduced ConfigAugmenter which can make changed to the configuration before a cache is build
    • Cache2kBuilder: Methods setup, apply allow to execute a function on the configuration or builder, which can be used to factor out configuration fragments. We use this to provide enable and disable methods on policies.
    • AdvancedCacheLoader, AsyncCacheLoader and ExpiryPolicy get null if current entry carries exception, https://github.com/cache2k/cache2k/issues/163
    • Remove ServiceLoader from JMX support in cache2k-jmx, cache2k-micrometer
    • Introduce concept of CacheFeature and ToggleCacheFeature
    • CacheType: immutable instead of bean. CacheType.of moved from CacheTypeCapture
    • Remove the need of serializable from the configuration objects, by doing a deep copy of the default configuration via bean setters and getters.
    • Cache2kConfig: Make setEternal a separate flag. Remove logic from setters, so we can use setters and getter to copy the object
    • Cache.mutate, Cache.mutateAll for a mutation only entry processor variant
    • @Nullable, @NonNull annotations
    • Within alpha: change new ExceptionPropagator from <K> to <K, V>, dito at LoadExceptionInfo
    • @Nullness annotations
    • Lots of typing refinements
    • Cache.entries and Cache.keys return a Set
    • Cache.computeIfAbsent with function
    • Ignore entryCapacity setting in case a weigher is specified
    • Allow listeners to throw a checked exception
    Source code(tar.gz)
    Source code(zip)
  • v1.9.1.Alpha(Oct 13, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    The preview is in preparation for version 2 which will have some major breaking changes to the previous releases. The final release will be 2.0.0.Final - "North Atlantic".

    New and Noteworthy

    • cache2k-api, cache2k-core, cache2k-jmx and cache2k-config are fully modularized
    • Requires at least Java 8 to run
    • Adaptions to Java 8 on API level. E.g. use of Duration in the configuration
    • New interfaces for CacheLoader and CacheWriter
    • Removal of deprecated classes and methods
    • JMX and XML configuration support is no longer part of cache2k-core
    • OSGi support with cache2k-osgi-all removed, see: https://github.com/cache2k/cache2k/issues/83

    Possible Breakages

    Since this is a major release, some rarely used things in the API are changed without backwards compatibility. Most code is supposed to run without breaking.

    • Requires at least Java 8 to run
    • Remove deprecated classes and methods: Cache.prefetch, Cache.prefetchAll, IntCache, LongCache, CacheEntry.getLastModification, AbstractCacheEntry
    • Incompatible change of CustomizationSupplier interface
    • org.cache2k.integration.ResiliencePolicy removed. Replaced by: org.cache2k.io.ResiliencePolicy
    • JMX support moved from cache2k-core to cache2k-jmx to minimize module dependencies
    • XML configuration moved from cache2k-core to cache2k-config to minimize module dependencies
    • Dropped apache commons logging support. Commons logging seems to be not maintained any more and lacks Jigsaw/module support.
    • Drop support for XML configuration on Android, removed XML pull dependency (The Android will be potentially unsupported in cache2k V2 at first)
    • Moved JCache configuration classes in org.cache.jcache from cache2k-api to cache2k-jcache. If these are used, cache2k-jcache needs to be in compile scope.
    • Cache2kConfiguration: Changed all parameters of type long, representing milliseconds to type Duration

    API Changes

    • org.cache2k.integration.CacheLoader and everything in package org.cache2k.integration is deprecated. Replacements are available in org.cache2k.io. This major change was done to change from abstract classes to interface. The new package was introduced for smoother transition to keep the previous classes and deprecated them.
    • Add Cache.loadAll and Cache.reloadAll which return CompletableFuture Old methods which use CacheOperationCompletionListener are deprecated
    • Remove deprecated classes and methods: Cache.prefetch, Cache.prefetchAll, IntCache, LongCache, CacheEntry.getLastModification, AbstractCacheEntry

    Fixes and Improvements

    • All cache customizations (e.g. CacheLoader) implement Customization.
    • Speedup of internal hash table, because compatibility for Java 6 could be removed
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0.Final(Oct 8, 2020)

    cache2k is a high performance and light weight in-process caching library. Compared to other libraries (EHCache, Guava and Caffeine) it achieves the highest throughput for cache hits while still providing one of the best eviction efficiency. Advanced features of cache2k, like refresh ahead and resilience can solve typical application problems with ease.

    This change log lists the complete changes since the last stable version 1.4.1.Final.

    New and Noteworthy

    • New timer based on hierarchical timer wheels, which is more performance and scales linear with more cache entries
    • No more extra thread per cache, in cache timer is used, e.g. for expiry

    Potential breakages

    • No separate executor for async listeners by default any more. If an async listener executor is not specified it uses the executor defined by Cache2kBuilder.executor which in turn defaults to the common ForkJoinPool in Java 8.
    • Slightly more lag for operations triggered by time, e.g. cache cleanup after expiry, calls of expiry listeners, refreshing. The lag can be controlled by Cache2kBuilder.timerLag

    API Changes

    • Deprecated ExpiryTimeValues.NO_CACHE
    • Deprecated Cache2kBuilder.prefetchExecutor, introduced Cache2kBuilder.refreshExecutor (rename)
    • Deprecated Cache.prefetch and Cache.prefetchAll

    Fixes and Improvements

    • Remove hash quality metric
    • MutableCacheEntry.reload() does load the entry even if already cached
    • After recovering from a load exception the expiry policy did not see the correct previous entry value with the exception
    • Improved internal structure and test coverage

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-base-pom</artifactId>
          <version>1.6.0.Final</version>
          <type>pom</type>
        </dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '1.6.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>1.6.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:1.6.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: [JCache - cache2k User Guide](https://cache2k.org/docs/latest/user-guide.html#jcache

    Source code(tar.gz)
    Source code(zip)
  • v1.5.2.Beta(Oct 8, 2020)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Gulf of Thailand 1.6.0.Final".

    New and Noteworthy

    • N/A

    Possible Breakages

    • N/A

    API Changes

    • Deprecated Cache.prefetch and Cache.prefetchAll

    Fixes and Improvements

    • After recovering from a load exception the expiry policy did not see the correct previous entry value with the exception
    • Improved internal structure and test coverage
    Source code(tar.gz)
    Source code(zip)
  • v1.5.1.Alpha(Oct 4, 2020)

    This is a preview release for evaluation purposes and should not be used in production. The final release is planed as "Gulf of Thailand 1.6.0.Final".

    New and Noteworthy

    • New timer based on hierarchical timer wheels, which is more performance and scales linear with more cache entries
    • No more extra thread per cache, in cache timer is used, e.g. for expiry

    Possible Breakages

    • No separate executor for async listeners by default any more. If an async listener executor is not specified it uses the executor defined by Cache2kBuilder.executor which in turn defaults to the common ForkJoinPool in Java 8.
    • Slightly more lag for operations triggered by time, e.g. cache cleanup after expiry, calls of expiry listeners, refreshing. The lag can be controlled by Cache2kBuilder.timerLag

    API Changes

    • Deprecated ExpiryTimeValues.NO_CACHE
    • Deprecated Cache2kBuilder.prefetchExecutor, introduced Cache2kBuilder.refreshExecutor (rename)

    Fixes and Improvements

    • Remove hash quality metric
    • MutableCacheEntry.reload() does load the entry even if already cached
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1.Final(Oct 2, 2020)

    cache2k is a high performance and light weight in-process caching library. Compared to other libraries (EHCache, Guava and Caffeine) it achieves the highest throughput for cache hits while still providing one of the best eviction efficiency. Advanced features of cache2k, like refresh ahead and resilience can solve typical application problems with ease.

    Critical bug fix for 1.4.0.Final.

    Fixes

    • Race under special conditions in Cache.computeIfAbsent, Cache.peekAndPut, Cache.get with loader. See: https://github.com/cache2k/cache2k/issues/155

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-base-pom</artifactId>
          <version>1.4.1.Final</version>
          <type>pom</type>
        </dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '1.4.1.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>1.4.1.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:1.4.1.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v1.4.0.Final(Sep 12, 2020)

    cache2k is a high performance and light weight in-process caching library. Compared to other libraries (EHCache, Guava and Caffeine) it achieves the highest throughput for cache hits while still providing one of the best eviction efficiency. Advanced features of cache2k, like refresh ahead and resilience can solve typical application problems with ease.

    This change log lists the complete changes since the last stable version 1.2.4.Final.

    New and Noteworthy

    • Weigher
    • AsyncCacheLoader
    • Eviction listener and eviction improvements
    • Synchronous execution of expiry listener
    • Micrometer support
    • Online resize of caches
    • Support for GraalVM native image build

    API Changes

    New methods / fields:

    • CacheManager.STANDARD_DEFAULT_MANAGER_NAME
    • CacheInfoMXBean.isWeigherPresent()
    • CacheInfoMXBean.isLoaderPresent()
    • CacheInfoMXBean.getTotalWeight()
    • CacheInfoMXBean.getMaximumWeight()
    • CacheInfoMXBean.getCapacityLimit()
    • Cache.getStatistics()

    New interface:

    • AsyncCacheLoader

    Deprecation:

    • IntCache, LongCache
    • Cache2kBuilder.buildIntCache(), Cache2kBuilder.buildLongCache()

    API Changes and Potential breakages

    Cache2kBuilder.addListener will execute an EntryExpiredLister synchronously. In version 1.2 an expiry listener was always executed asynchronously. This is an potentially incompatible change, in case expiry listeners are used. Review the existing client code and make sure that addAsyncListeners is used for an EntryExpiredLister if that is wanted.

    Fixes

    • Fix CacheManager.setDefaultName, see GH#108
    • race of refresh and delete: if an entry is deleted via Cache.remove it was not reappearing when refreshed concurrently
    • fix missing expiry listener call after a created listener call, in case expiry during the insert
    • expiry, expireAfterWrite, refreshAhead: Fix race condition of a Cache.put and the

    Improvements

    • Remove randomized hash seed and simplify the "rehashing" of hash codes identical to Java HashMap and ConcurrentHashMap
    • Async Cacheloader GH#93
    • CacheEntryEvictionListener added, GH#59
    • Expose cache statistics via Cache.getStatistics()
    • Eviction: Efficiency improvements, see comment: https://github.com/cache2k/cache2k/issues/101#issuecomment-523003823
    • Expiry listener supports synchronous operation
    • Deprecated IntCache and LongCache
    • Internal: Improvement and simplification of ExceptionPropagator handling termination of the probation period after a refresh.
    • Cache.invoke / EntryProcessor: Internal improvements when using listeners: avoid unnecessary entry reads
    • internal cleanup: use common code for refresh in different cache variants
    • eviction efficiency fix for a few special short traces
    • Support for new cache methods from Spring Framework 5.2
    • doc clarifications and improvements
    • SpringCache2kCacheManager.setAllowUnknownCache is true by default, to minimize initial setup
    • CacheEntry.toString output does not call toString on the value and print hashCode instead
    • doc clarifications
    • Code style improvements

    Using this cache2k version

    The binaries are available on maven central.

    For Java SE/EE and Android environments

    For Maven users:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-base-pom</artifactId>
          <version>1.4.0.Final</version>
          <type>pom</type>
        </dependency>
    

    Recommended for Gradle users:

    def cache2kVersion = '1.4.0.Final'
    
    dependencies {
        implementation "org.cache2k:cache2k-api:${cache2kVersion}"
        runtimeOnly "org.cache2k:cache2k-core:${cache2kVersion}"
    }
    

    Note to Android users: The included jar files contain code that might only be needed in server environments (e.g. JMX support). It is possible to strip unnecessary code. Example ProGuard rules can be found at Andriod - cache2k User Guide

    Using the JCache / JSR107 provider

    Maven users include the cache2k JCache provider this way:

        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>1.4.0.Final</version>
          <scope>runtime</scope>
        </dependency>
    

    For Gradle users:

    dependencies {
        runtimeOnly "org.cache2k:cache2k-jcache:1.4.0.Final"
    }
    

    Implementation details, tuning tips and hints on configuration can be found at: JCache - cache2k User Guide

    Source code(tar.gz)
    Source code(zip)
  • v1.3.8.Beta(Sep 10, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    New and Noteworthy

    • Stabilizing new features

    Possible Breakages

    • A created SpringCache2kCacheManager binds to the cache2k cache manager springDefault instead to default.

    API Changes

    • N/A

    Fixes and Improvements

    • Micrometer support: don't register to any registry by default
    • Clarify semantics of current entry for AdvancedCacheLoader and AsyncCacheLoader
    Source code(tar.gz)
    Source code(zip)
  • v1.3.7.Beta(Aug 30, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    New and Noteworthy

    • Stabilizing new features

    Possible Breakages

    • N/A

    API Changes

    • N/A

    Fixes and Improvements

    • Fix corrupted JSON file for GraalVM native image build in last release
    Source code(tar.gz)
    Source code(zip)
  • v1.3.6.Beta(Aug 30, 2020)

    This is a preview release for evaluation purposes and should not be used in production.

    New and Noteworthy

    • Stabilizing new features

    Possible Breakages

    • N/A

    API Changes

    • N/A

    Fixes and Improvements

    • Improved GraalVM native image support, no extra configuration needed, https://github.com/cache2k/cache2k/issues/152
    • Correct wrong EntryProcessor behavior introduced during version 1.3.x
    Source code(tar.gz)
    Source code(zip)
Owner
High Performance Java Caching
null
HyCache - an open source caching tool based on bytecode enhancement implementation

HyCache is an open source caching tool.It is based on bytecode enhancement implementation, rather than spring's dynamic proxy. It can achieve a wider range of applications

zhaoshaohai 3 Sep 6, 2022
A blazingly small and sane redis java client

Jedis Jedis is a blazingly small and sane Redis java client. Jedis was conceived to be EASY to use. Jedis is fully compatible with redis 2.8.x, 3.x.x

Redis 10.8k Dec 31, 2022
A high performance caching library for Java

Caffeine is a high performance, near optimal caching library. For more details, see our user's guide and browse the API docs for the latest release. C

Ben Manes 13k Jan 3, 2023
A high performance caching library for Java

Caffeine is a high performance, near optimal caching library. For more details, see our user's guide and browse the API docs for the latest release. C

Ben Manes 13k Jan 5, 2023
An Intuitive, Lightweight, High Performance Full Stack Java Web Framework.

mangoo I/O mangoo I/O is a Modern, Intuitive, Lightweight, High Performance Full Stack Java Web Framework. It is a classic MVC-Framework. The foundati

Sven Kubiak 52 Oct 31, 2022
A high available,high performance distributed messaging system.

#新闻 MetaQ 1.4.6.2发布。更新日志 MetaQ 1.4.6.1发布。更新日志 MetaQ 1.4.5.1发布。更新日志 MetaQ 1.4.5发布。更新日志 Meta-ruby 0.1 released: a ruby client for metaq. SOURCE #介绍 Meta

dennis zhuang 1.3k Dec 12, 2022
A Simple movies app using JAVA,MVVM and with a offline caching capability

IMDB-CLONE A simple imdb clone using JAVA,MVVM with searching and bookmarking ability with offline caching ability screenshots Home Screen 1 Home Scre

saiteja janjirala 13 Aug 16, 2022
Spring-boot application using redis as a caching database

Java Spring-boot application using Redis as a caching database Running Application Entities involved Two main entities are involved MasterHouse (maste

null 18 Aug 9, 2022
Powerful and flexible library for loading, caching and displaying images on Android.

Universal Image Loader The great ancestor of modern image-loading libraries :) UIL aims to provide a powerful, flexible and highly customizable instru

Sergey Tarasevich 16.8k Jan 2, 2023
An image loading and caching library for Android focused on smooth scrolling

Glide | View Glide's documentation | 简体中文文档 | Report an issue with Glide Glide is a fast and efficient open source media management and image loading

Bump Technologies 33.2k Dec 31, 2022
A powerful image downloading and caching library for Android

Picasso A powerful image downloading and caching library for Android For more information please see the website Download Download the latest AAR from

Square 18.4k Dec 31, 2022
Simple springboot API for addressBook. Supports all REST controllers and have custom error handling for every specific case, also supports redis caching.

AddressBook-SpringBoot-API Simple Springboot API for addressBook with redis cache. Supports all REST controllers and have custom error handling for ev

Shirish Saxena 1 Jan 21, 2022
HyCache - an open source caching tool based on bytecode enhancement implementation

HyCache is an open source caching tool.It is based on bytecode enhancement implementation, rather than spring's dynamic proxy. It can achieve a wider range of applications

zhaoshaohai 3 Sep 6, 2022
A high-level and lightweight HTTP client framework for Java. it makes sending HTTP requests in Java easier.

A high-level and lightweight HTTP client framework for Java. it makes sending HTTP requests in Java easier.

dromara 1.2k Jan 8, 2023
ActiveJ is an alternative Java platform built from the ground up. ActiveJ redefines web, high load, and cloud programming in Java, featuring ultimate performance and scalability!

Introduction ActiveJ is a full-featured modern Java platform, created from the ground up as an alternative to Spring/Micronauts/Netty/Jetty. It is des

ActiveJ LLC 579 Jan 7, 2023
Elegance, high performance and robustness all in one java bean mapper

JMapper Framework Fast as hand-written code with zero compromise. Artifact information Status Write the configuration using what you prefer: Annotatio

null 200 Dec 29, 2022
High performance CSV reader and writer for Java.

FastCSV ?? FastCSV 2.0 upgrade has landed with major improvements on performance and usability! FastCSV is an ultra-fast and dependency-free RFC 4180

Oliver Siegmar 411 Dec 22, 2022
High Performance data structures and utility methods for Java

Agrona Agrona provides a library of data structures and utility methods that are a common need when building high-performance applications in Java. Ma

Real Logic 2.4k Dec 31, 2022
High performance Java reflection

Please use the ReflectASM discussion group for support. Overview ReflectASM is a very small Java library that provides high performance reflection by

Esoteric Software 1.4k Dec 31, 2022