Interface ValueCache
@NonNullByDefault
public interface ValueCache
The
ValueCache
can be used by scripts to share information between subsequent runs of the same script or
between scripts (depending on implementation).- Author:
- Jan N. Klug - Initial contribution
-
Method Summary
-
Method Details
-
put
Add a new key-value-pair to the cache. If the key is already present, the old value is replaces by the new value.- Parameters:
key
- a string used as keyvalue
- anObject
to store with the key- Returns:
- the old value associated with this key or
null
if key didn't exist
-
remove
Remove a key (and its associated value) from the cache- Parameters:
key
- the key to remove- Returns:
- the previously associated value to this key or
null
if key not present
-
get
Get a value from the cache- Parameters:
key
- the key of the requested value- Returns:
- the value associated with the key or
null
if key not present
-
get
Get a value from the cache or create a new key-value-pair from the given supplier- Parameters:
key
- the key of the requested valuesupplier
- a supplier that returns a non-null value to be used if the key was not present- Returns:
- the value associated with the key
-