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 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.
    • 0๏ธโƒฃ No caching of exceptions by default. This has to be enabled explicitly by specifying
      0๏ธโƒฃ 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, #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