Class CachedSupplier.Builder<T>
- java.lang.Object
-
- software.amazon.awssdk.utils.cache.CachedSupplier.Builder<T>
-
- Enclosing class:
- CachedSupplier<T>
public static final class CachedSupplier.Builder<T> extends Object
A Builder forCachedSupplier
, created byCachedSupplier.builder(Supplier)
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CachedSupplier<T>
build()
Create aCachedSupplier
using the current configuration of this builder.CachedSupplier.Builder<T>
cachedValueName(String cachedValueName)
Configures a name for the cached value.CachedSupplier.Builder<T>
clock(Clock clock)
Configure the clock used for this cached supplier.CachedSupplier.Builder<T>
prefetchStrategy(CachedSupplier.PrefetchStrategy prefetchStrategy)
Configure the way in which data in the cache should be pre-fetched when the data'sRefreshResult.prefetchTime()
arrives.CachedSupplier.Builder<T>
staleValueBehavior(CachedSupplier.StaleValueBehavior staleValueBehavior)
Configure the way the cache should behave when a stale value is retrieved or when retrieving a value fails while the cache is stale.
-
-
-
Method Detail
-
prefetchStrategy
public CachedSupplier.Builder<T> prefetchStrategy(CachedSupplier.PrefetchStrategy prefetchStrategy)
Configure the way in which data in the cache should be pre-fetched when the data'sRefreshResult.prefetchTime()
arrives. By default, this uses theOneCallerBlocks
strategy, which will block a singleCachedSupplier.get()
caller to update the value.
-
staleValueBehavior
public CachedSupplier.Builder<T> staleValueBehavior(CachedSupplier.StaleValueBehavior staleValueBehavior)
Configure the way the cache should behave when a stale value is retrieved or when retrieving a value fails while the cache is stale. By default, this usesCachedSupplier.StaleValueBehavior.STRICT
.
-
cachedValueName
public CachedSupplier.Builder<T> cachedValueName(String cachedValueName)
Configures a name for the cached value. This name will be included with logs emitted by this supplier, to aid in debugging. By default, this uses "unknown".
-
clock
public CachedSupplier.Builder<T> clock(Clock clock)
Configure the clock used for this cached supplier. Configurable for testing.
-
build
public CachedSupplier<T> build()
Create aCachedSupplier
using the current configuration of this builder.
-
-