Class CachingSupplier<T>

  • All Implemented Interfaces:
    java.util.function.Supplier<T>

    public class CachingSupplier<T>
    extends java.lang.Object
    implements java.util.function.Supplier<T>
    Caching layer between Supplier and caller.

    Refreshes the value if 30 seconds have passed since the last call.

    • Constructor Summary

      Constructors 
      Constructor Description
      CachingSupplier​(java.util.function.Supplier<T> original)  
      CachingSupplier​(java.util.function.Supplier<T> original, long timeToLive)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachingSupplier

        public CachingSupplier​(java.util.function.Supplier<T> original)
      • CachingSupplier

        public CachingSupplier​(java.util.function.Supplier<T> original,
                               long timeToLive)
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface java.util.function.Supplier<T>