Package org.forgerock.openig.tools
Class CaffeineUtils
- java.lang.Object
-
- org.forgerock.openig.tools.CaffeineUtils
-
public final class CaffeineUtils extends Object
Utility class for Caffeine-related workarounds.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V,E extends Exception>
Promise<V,E>invalidateEagerly(com.github.benmanes.caffeine.cache.AsyncCache<K,V> cache, Promise<V,E> promise, K key)
Preemptively invalidates the cache entry on failure.
-
-
-
Method Detail
-
invalidateEagerly
public static <K,V,E extends Exception> Promise<V,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:
- Caffeine issue 372
-
-