Package org.ojalgo.type
Class ForgetfulMap.ValueCache<K,V>
java.lang.Object
org.ojalgo.type.ForgetfulMap.ValueCache<K,V>
- Enclosing class:
ForgetfulMap<K,
V>
A re-implementation of
TypeCache
backed by a ForgetfulMap
. Essentially it's a supplier
that most of the time returns a cached value, and only recomputes it periodically.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionValueCache
(K key, ForgetfulMap<K, V> cache, Function<? super K, ? extends V> valueSupplier) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final V
final boolean
Is there currently a value cached for this key?final boolean
isDirty()
final void
Will force re-creation of the value the next timegetCachedObject()
is called.
-
Field Details
-
myCache
-
myDirty
private volatile boolean myDirty -
myKey
-
myValueSupplier
-
-
Constructor Details
-
ValueCache
-
-
Method Details
-
flushCache
public final void flushCache() -
getCachedObject
-
isCacheSet
public final boolean isCacheSet()Is there currently a value cached for this key? -
isDirty
public final boolean isDirty()- Returns:
- true if
makeDirty()
has been called since the last timegetCachedObject()
was called.
-
makeDirty
public final void makeDirty()Will force re-creation of the value the next timegetCachedObject()
is called. This method does NOT immediately remove or invalidate the value from the underlying cache.
-