Package aQute.bnd.memoize
Class RefreshingMemoizingSupplier<T>
- java.lang.Object
-
- aQute.bnd.memoize.RefreshingMemoizingSupplier<T>
-
- All Implemented Interfaces:
Memoize<T>,java.util.function.Supplier<T>
class RefreshingMemoizingSupplier<T> extends java.lang.Object implements Memoize<T>
The object can exist in one of two states:- expired which means that System.nanoTime is greater than timebound. memoized may hold an expired value or null. The object transitions to this state when time_to_live elapses. This is the initial state. From this state, the object transitions to valued when @{code get} is called.
- valued which means that System.nanoTime is less than timebound. memoized holds the current value.
-
-
Constructor Summary
Constructors Constructor Description RefreshingMemoizingSupplier(java.util.function.Supplier<? extends T> supplier, long time_to_live, java.util.concurrent.TimeUnit unit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget()Get the memoized value.booleanisPresent()If a value is memoized, returntrue.Tpeek()Peek the memoized value, if any.java.lang.StringtoString()
-
-
-
Constructor Detail
-
RefreshingMemoizingSupplier
RefreshingMemoizingSupplier(java.util.function.Supplier<? extends T> supplier, long time_to_live, java.util.concurrent.TimeUnit unit)
-
-
Method Detail
-
peek
public T peek()
Description copied from interface:MemoizePeek the memoized value, if any.This method will not result in a call to the source supplier.
-
isPresent
public boolean isPresent()
Description copied from interface:MemoizeIf a value is memoized, returntrue. Otherwise returnfalse.This method will not result in a call to the source supplier.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-