Class IdentifiedCacheDelegate
java.lang.Object
org.qubership.atp.dataset.db.utils.IdentifiedCacheDelegate
- All Implemented Interfaces:
IdentifiedCache
- Direct Known Subclasses:
CacheRepository
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()<T extends Identified>
TcomputeIfAbsent(Class<T> type, UUID id, Function<UUID, ? extends T> sourceFunc) Returns value if it is already present in the cache.protected abstract IdentifiedCachegetCache()<T extends Identified>
TgetIfPresent(Class<T> type, UUID id) <T extends Identified>
void<T extends Identified>
TtryComputeIfAbsent(Class<T> type, UUID id, Function<UUID, ? extends T> sourceFunc) Returns value if it is already present in the cache.
-
Constructor Details
-
IdentifiedCacheDelegate
public IdentifiedCacheDelegate()
-
-
Method Details
-
computeIfAbsent
@Nonnull public <T extends Identified> T computeIfAbsent(@Nonnull Class<T> type, @Nonnull UUID id, @Nonnull Function<UUID, ? extends T> sourceFunc) Description copied from interface:IdentifiedCacheReturns value if it is already present in the cache. Invokes function otherwise. Function should not return null. Caches new provided value.- Specified by:
computeIfAbsentin interfaceIdentifiedCache
-
tryComputeIfAbsent
@Nullable public <T extends Identified> T tryComputeIfAbsent(@Nonnull Class<T> type, @Nonnull UUID id, @Nonnull Function<UUID, ? extends T> sourceFunc) Description copied from interface:IdentifiedCacheReturns value if it is already present in the cache. Invokes function otherwise. Function may return null. Caches new provided value (if it is not null).- Specified by:
tryComputeIfAbsentin interfaceIdentifiedCache
-
getIfPresent
- Specified by:
getIfPresentin interfaceIdentifiedCache
-
put
- Specified by:
putin interfaceIdentifiedCache
-
clear
public void clear()- Specified by:
clearin interfaceIdentifiedCache
-
getCache
-