Class Suppliers.ExpiringMemoizingSupplier<T>

  • All Implemented Interfaces:
    Supplier<T>, java.io.Serializable, java.util.function.Supplier<T>
    Enclosing class:
    Suppliers

    static class Suppliers.ExpiringMemoizingSupplier<T>
    extends java.lang.Object
    implements Supplier<T>, java.io.Serializable
    • Field Detail

      • durationNanos

        final long durationNanos
      • value

        @CheckForNull
        transient volatile T value
      • expirationNanos

        transient volatile long expirationNanos
    • Constructor Detail

      • ExpiringMemoizingSupplier

        ExpiringMemoizingSupplier​(Supplier<T> delegate,
                                  long duration,
                                  java.util.concurrent.TimeUnit unit)
    • Method Detail

      • get

        public T get()
        Description copied from interface: Supplier
        Retrieves an instance of the appropriate type. The returned object may or may not be a new instance, depending on the implementation.
        Specified by:
        get in interface Supplier<T>
        Specified by:
        get in interface java.util.function.Supplier<T>
        Returns:
        an instance of the appropriate type
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object