@Override
    public T get() {
        synchronized (monitor) {
            if (clock.instant().isAfter(nextRefresh)) {
                this.value = delegate.get();
                this.nextRefresh = clock.instant().plus(period);
            }
        }

        return value;
    }
Supplier that caches the value for a given duration with ability to invalidate on demand.
Is thread safe.

@author freva
vespajlib/src/main/java/com/yahoo/lang/CachedSupplier.java