cache2k v1.9.2.Alpha Release Notes
Release Date: 2020-11-23 // over 3 years ago-
๐ 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
- 0๏ธโฃ No caching of exceptions by default. This has to be enabled explicitly by specifying
0๏ธโฃResiliencePolicy
. Previous default resilience available asUniversalResiliencePolicy
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 byCacheManagement.of(Cache).sampleStatistics()
. - ๐
Cache.clearAndClose
removed. Replaced byCacheManagement.destroy
- โ Removed deprecated
MutableCacheEntry.getCurrentTime
, replaced withgetStartTime
- โ Remove
MutableCacheEntry.wasExisting
andMutableCacheEntry.getOldValue
- ๐ Rename
MutableCacheEntry.getRefreshedTime
togetModificationTime
MutableCacheEntry.exists
: Does not change the value aftersetValue
or triggered loadMutableCacheEntry.getValue
: Does not change the value aftersetValue
- ๐ง Every class with
Configuration
shortened toConfig
and consequently changed the
๐ง package nameorg.cache2k.configuration
toorg.cache2k.config
. Cache2kBuilder.toConfiguration()
renamed toconfig()
- ๐ง Lots restructuring around the extra configuration sections and customizations
- โ remove
Cache2kBuilder.enableJmx
. Replaced withCache2kBuilder.enable(JmxSupport.class)
- ๐
Cache.requestInterface
throwsUnsupportedOperationException
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. - 0๏ธโฃ No caching of exceptions by default. This has to be enabled explicitly by specifying
0๏ธโฃResiliencePolicy
. Previous default resilience available asUniversalResiliencePolicy
in
cache2k-addon
API Changes
- ๐ Renamed
ExceptionInformation
toLoadExceptionInfo
- ๐ New method
CacheEntry.getExceptionInfo()
- ๐
org.cache2k.jmx
, API for JMX MXBeans removed - ๐ New interfaces
CacheManagement
,CacheControl
andCacheInfo
inorg.cache2k.management
- ๐ New method:
MutableCacheEntry.lock
- ๐ Rename
MutableCacheEntry.reload
toMutableCacheEntry.load
- โ Remove
TimeReference
interface from public API and make that local tocache2k-core
- ๐ New method:
MutableCacheEntry.getExpiryTime()
- โ Remove
Cache2kBuilder.enableJmx
Cache2kBuilder
: New methods `set- ๐ New methods:
Cache.mutate
,Cache.mutateAll
๐ Fixes and Improvements
- ๐ป
Cache.loadAll()
andCache.reloadAll()
complete with exception if a a loader
๐ป exception happened. If more than one exception happened the one is propagated. - ๐ Improved interface of
ExceptionPropagator
andLoadExceptionInfo
,
๐ป ACacheEntry
may be cast toLoadExceptionInfo
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
: Methodssetup
,apply
allow to execute a function on the configuration
๐ or builder, which can be used to factor out configuration fragments.
We use this to provideenable
anddisable
methods on policies. - ๐ป AdvancedCacheLoader, AsyncCacheLoader and ExpiryPolicy get null if current entry carries exception, #163
- โ Remove ServiceLoader from JMX support in
cache2k-jmx
,cache2k-micrometer
- Introduce concept of
CacheFeature
andToggleCacheFeature
- ๐
CacheType
: immutable instead of bean.CacheType.of
moved fromCacheTypeCapture
- โ Remove the need of serializable from the configuration objects, by doing a deep
๐ง copy of the default configuration via bean setters and getters. Cache2kConfig
: MakesetEternal
a separate flag.
โ Remove logic from setters, so we can use setters and getter to copy the
objectCache.mutate
,Cache.mutateAll
for a mutation only entry processor variant@Nullable
,@NonNull
annotations- Within alpha: change new ExceptionPropagator from
<K>
to<K, V>
, dito atLoadExceptionInfo
- @nullness annotations
- Lots of typing refinements
Cache.entries
andCache.keys
return aSet
Cache.computeIfAbsent
with function- Ignore
entryCapacity
setting in case a weigher is specified - ๐ Allow listeners to throw a checked exception