cache2k 1.1.2.Alpha
This version is a development preview and not recommended for production use. Please give feedback to help stabilize and improve the next version.
New and Noteworthy
- Optimized cache version for integer keys with better memory footprint and access performance since no autoboxing is needed.
- Support for Spring caching abstraction. See the user guide on Spring Framework Integration
API Changes
IntCacheandLongCachefor int and long keys, plusIntKeyValueSourceandLongKeyValueSourceCache2kBuilder.getManager()returns the cache managerCache.computeIfAbsentpropagatesRuntimeExceptionwithout wrapping
Fixes and Improvements
- Code quality: Unused code removed, various tests with simulated clock for expiry and refresh added
CacheEntry.getLastModificationTime()throws exception if this functionality is disabled- skip time recording correctly when
disableLastModificationTimeis set - Remove
SimpleCacheEntryintroduced before in1.1.1.Aplhasince this bloats the API - Rename thread prefrix for async listener execution from
cache2k-asynctocache2k-listener - Add
CacheManager.getConfiguredCacheNamesto get a list of caches that are specified in the XML configuration - JCache: If a cache is present in the XML configuration
CacheManager.getCachecreates the cache based on the present configuration. Some clients (e.g. Spring) useCacheManager.getCacheto request an exiting/known cache. - JCache: ignore
isWriteThroughflag and just use the writer when present. This avoids an NPE if a cache client enables write through but does not provide a writer (as found in datanucleus). Cache.replaceIfEquals: Fix potential NPE, if listener or writer is used
Using this cache2k version
For Java SE/EE and Android environments
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-api</artifactId>
<version>1.1.2.Alpha</version>
</dependency>
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-impl</artifactId>
<version>1.1.2.Alpha</version>
<scope>runtime</scope>
</dependency>
Note to Android users: The cache2k-impl contains code that might only be needed in server environments (e.g. JMX support). If not needed, it is possible to strip unnecessary code. Example ProGuard rules can be found at cache2k user guide - Android secion
Using the JCache / JSR107 provider
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-jcache</artifactId>
<version>1.1.2.Alpha</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.0</version>
</dependency>