public final class Memoizer extends Object
| Modifier and Type | Method and Description |
|---|---|
static long |
defaultExpiration()
Default exipiration of memoized values in nanoseconds, which will refresh
after this time elapses.
|
static <T> Supplier<T> |
memoize(Supplier<T> original)
Store a supplier in a delegate function to be computed only once.
|
static <T> Supplier<T> |
memoize(Supplier<T> original,
long ttlNanos)
Store a supplier in a delegate function to be computed once, and only again
after time to live (ttl) has expired.
|
public static long defaultExpiration()
Config property
oshi.util.memoizer.expiration to a value in milliseconds.public static <T> Supplier<T> memoize(Supplier<T> original, long ttlNanos)
T - The type of object suppliedoriginal - The Supplier to memoizettlNanos - Time in nanoseconds to retain calculation. If negative, retain
indefinitely.Copyright © 2020. All rights reserved.