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'sRefreshResult.prefetchTime()arrives.- See Also:
OneCallerBlocks,NonBlocking
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()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 voidinitializeCachedSupplier(CachedSupplier<?> cachedSupplier)Invoked when the prefetch strategy is registered with aCachedSupplier.voidprefetch(Runnable valueUpdater)Execute the provided value updater to update the cache.
-
-
-
Method Detail
-
prefetch
void prefetch(Runnable valueUpdater)
Execute the provided value updater to update the cache. The specific implementation defines how this is invoked.
-
fetch
default <T> RefreshResult<T> fetch(Supplier<RefreshResult<T>> supplier)
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
default void initializeCachedSupplier(CachedSupplier<?> cachedSupplier)
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
-