Package org.forgerock.openig.tools
Class CaffeineUtils
java.lang.Object
org.forgerock.openig.tools.CaffeineUtils
Utility class for Caffeine-related workarounds.
-
Method Summary
Modifier and TypeMethodDescriptioninvalidateEagerly
(com.github.benmanes.caffeine.cache.AsyncCache<K, V> cache, Promise<V, E> promise, K key) Preemptively invalidates the cache entry on failure.
-
Method Details
-
invalidateEagerly
public static <K,V, Promise<V,E extends Exception> E> invalidateEagerly(com.github.benmanes.caffeine.cache.AsyncCache<K, V> cache, Promise<V, E> promise, K key) Preemptively invalidates the cache entry on failure.Let Caffeine handle the removal if the entry is already completed. This avoids a recursive modification issue from the underlying map implementation.
- Type Parameters:
K
- type of the keyV
- type of the cached valueE
- promise's exception type- Parameters:
cache
- the async cachepromise
- promise of the cache entrykey
- the looked up key- Returns:
- a new promise doing the eager cache invalidation (if it's not completed yet), otherwise the same promise.
- See Also:
-