Class CachedSupplier<T>

  • All Implemented Interfaces:
    AutoCloseable, Supplier<T>, SdkAutoCloseable

    public class CachedSupplier<T>
    extends Object
    implements Supplier<T>, SdkAutoCloseable
    A wrapper for a Supplier that applies certain caching rules to the retrieval of its value, including customizable pre-fetching behaviors for updating values as they get close to expiring so that not all threads have to block to update the value. For example, the OneCallerBlocks strategy will have a single caller block to update the value, and the NonBlocking strategy maintains a thread pool for updating the value asynchronously in the background. This should be created using builder(Supplier).