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 Details

    • 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 a CachedSupplier.
    • close

      default void close()
      Free any resources associated with the strategy. This is invoked when the CachedSupplier.close() method is invoked.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SdkAutoCloseable