Class NamedCache
java.lang.Object
io.fluxzero.sdk.persisting.caching.NamedCache
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidclose()<T> Tcompute(Object id, BiFunction<? super Object, ? super T, ? extends T> mappingFunction) <T> TcomputeIfAbsent(Object id, Function<? super Object, T> mappingFunction) <T> TcomputeIfPresent(Object id, BiFunction<? super Object, ? super T, ? extends T> mappingFunction) booleancontainsKey(Object id) <T> Tdefault <T> TgetOrDefault(Object arg0, T arg1) default booleanisEmpty()<T> voidmodifyEach(BiFunction<? super Object, ? super T, ? extends T> modifierFunction) putIfAbsent(Object id, @NonNull Object value) io.fluxzero.common.caching.Cacherebuild()io.fluxzero.common.RegistrationregisterEvictionListener(Consumer<io.fluxzero.common.caching.CacheEviction> listener) <T> Tintsize()
-
Constructor Details
-
NamedCache
public NamedCache()
-
-
Method Details
-
put
-
putIfAbsent
-
computeIfAbsent
-
computeIfPresent
public <T> T computeIfPresent(Object id, BiFunction<? super Object, ? super T, ? extends T> mappingFunction) -
compute
-
modifyEach
-
get
-
containsKey
-
remove
-
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
-
isEmpty
default boolean isEmpty()
-