Class ForgetfulMap.ValueCache<K,V>

java.lang.Object
org.ojalgo.type.ForgetfulMap.ValueCache<K,V>
Enclosing class:
ForgetfulMap<K,V>

public static final class ForgetfulMap.ValueCache<K,V> extends Object
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 Details

    • myCache

      private final ForgetfulMap<K,V> myCache
    • myDirty

      private volatile boolean myDirty
    • myKey

      private final K myKey
    • myValueSupplier

      private final Function<? super K,? extends V> myValueSupplier
  • Constructor Details

  • Method Details

    • flushCache

      public final void flushCache()
    • getCachedObject

      public final V 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 time getCachedObject() was called.
    • makeDirty

      public final void makeDirty()
      Will force re-creation of the value the next time getCachedObject() is called. This method does NOT immediately remove or invalidate the value from the underlying cache.