Interface CachedSupplier.PrefetchStrategy
- All Superinterfaces:
AutoCloseable
,SdkAutoCloseable
- All Known Implementing Classes:
NonBlocking
,OneCallerBlocks
- Enclosing class:
CachedSupplier<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface CachedSupplier.PrefetchStrategy
extends SdkAutoCloseable
The way in which the cache should be pre-fetched when the data's
RefreshResult.prefetchTime()
arrives.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Free any resources associated with the strategy.default <T> RefreshResult
<T> fetch
(Supplier<RefreshResult<T>> supplier) Invoke the provided supplier to retrieve the refresh result.default void
initializeCachedSupplier
(CachedSupplier<?> cachedSupplier) Invoked when the prefetch strategy is registered with aCachedSupplier
.void
Execute the provided value updater to update the cache.
-
Method Details
-
prefetch
Execute the provided value updater to update the cache. The specific implementation defines how this is invoked. -
fetch
Invoke the provided supplier to retrieve the refresh result. This is useful for prefetch strategies to override when they care about the refresh result. -
initializeCachedSupplier
Invoked when the prefetch strategy is registered with aCachedSupplier
. -
close
default void close()Free any resources associated with the strategy. This is invoked when theCachedSupplier.close()
method is invoked.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-