Package com.yahoo.lang
Class CachedSupplier<T>
- java.lang.Object
-
- com.yahoo.lang.CachedSupplier<T>
-
- All Implemented Interfaces:
java.util.function.Supplier<T>
public class CachedSupplier<T> extends java.lang.Object implements java.util.function.Supplier<T>
Supplier that caches the value for a given duration with ability to invalidate on demand. Is thread safe.- Author:
- freva
-
-
Constructor Summary
Constructors Constructor Description CachedSupplier(java.util.function.Supplier<T> delegate, java.time.Duration period)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
void
invalidate()
-