public static final class CachedSupplier.Builder<T> extends Object
CachedSupplier
, created by CachedSupplier.builder(Supplier)
.Modifier and Type | Method and Description |
---|---|
CachedSupplier<T> |
build()
Create a
CachedSupplier using the current configuration of this builder. |
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's
RefreshResult.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.
|
public CachedSupplier.Builder<T> prefetchStrategy(CachedSupplier.PrefetchStrategy prefetchStrategy)
RefreshResult.prefetchTime()
arrives.
By default, this uses the OneCallerBlocks
strategy, which will block a single CachedSupplier.get()
caller to update
the value.public CachedSupplier.Builder<T> staleValueBehavior(CachedSupplier.StaleValueBehavior staleValueBehavior)
CachedSupplier.StaleValueBehavior.STRICT
.public CachedSupplier.Builder<T> clock(Clock clock)
public CachedSupplier<T> build()
CachedSupplier
using the current configuration of this builder.Copyright © 2023. All rights reserved.