Class DefaultCache

java.lang.Object
io.fluxzero.sdk.persisting.caching.DefaultCache
All Implemented Interfaces:
AutoCloseable

public final class DefaultCache extends Object implements AutoCloseable
Default aggregate cache facade that selects the current SDK cache implementation from Fluxzero cache properties.

Existing applications without a defaults version or explicit MODE_PROPERTY keep the legacy SoftReferenceCache. Newer applications that use Fluxzero defaults >= 2026.05.25, or set fluxzero.cache.mode = adaptive, use AdaptiveObjectCache.

  • Field Details

  • Constructor Details

    • DefaultCache

      public DefaultCache()
      Constructs a cache using the active Fluxzero property source, or the default property source when no Fluxzero instance is active.
    • DefaultCache

      public DefaultCache(io.fluxzero.common.application.PropertySource propertySource)
      Constructs a cache using the given property source for cache mode and defaults-version selection.
    • DefaultCache

      public DefaultCache(io.fluxzero.common.application.PropertySource propertySource, int maxSize)
      Constructs a cache using the given property source for cache mode and defaults-version selection, with a custom max size for the selected implementation.
    • DefaultCache

      public DefaultCache(int maxSize)
      Constructs a cache with a specified max size for the selected implementation.
    • DefaultCache

      public DefaultCache(int maxSize, Duration expiry)
      Constructs a cache with specified size and expiration for the selected implementation.
  • Method Details

    • delegate

      public io.fluxzero.common.caching.Cache delegate()
      Returns the selected cache implementation.
    • put

      public Object put(Object id, Object value)
    • putIfAbsent

      public Object putIfAbsent(Object id, Object value)
    • computeIfAbsent

      public <T> T computeIfAbsent(Object id, Function<? super Object, T> mappingFunction)
    • computeIfPresent

      public <T> T computeIfPresent(Object id, BiFunction<? super Object, ? super T, ? extends T> mappingFunction)
    • compute

      public <T> T compute(Object id, BiFunction<? super Object, ? super T, ? extends T> mappingFunction)
    • modifyEach

      public <T> void modifyEach(BiFunction<? super Object, ? super T, ? extends T> modifierFunction)
    • get

      public <T> T get(Object id)
    • containsKey

      public boolean containsKey(Object id)
    • remove

      public <T> T remove(Object id)
    • clear

      public void clear()
    • size

      public int size()
    • registerEvictionListener

      public io.fluxzero.common.Registration registerEvictionListener(Consumer<io.fluxzero.common.caching.CacheEviction> listener)
    • rebuild

      public io.fluxzero.common.caching.Cache rebuild()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getOrDefault

      default <T> T getOrDefault(Object arg0, T arg1)
    • isEmpty

      default boolean isEmpty()