Class NamedCache

java.lang.Object
io.fluxzero.sdk.persisting.caching.NamedCache

public class NamedCache extends Object
A Cache implementation that wraps a delegate cache and applies a transformation to each key (ID) before delegating operations to the underlying cache.

This allows multiple cache users to safely share the same underlying Cache instance without risk of key collisions. Typical use cases include namespacing by type, context, or scope.

  • Constructor Details

    • NamedCache

      public NamedCache()
  • Method Details

    • put

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

      public Object putIfAbsent(Object id, @NonNull @NonNull 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()
    • getOrDefault

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

      default boolean isEmpty()