java.lang.Object
org.eclipse.persistence.internal.cache.Memoizer<A,V>
All Implemented Interfaces:
LowLevelProcessor<A,V>

public class Memoizer<A,V> extends Object implements LowLevelProcessor<A,V>
Memoizer for computing resource expensive tasks asynchronously & concurrently. Inspired by D. Lea. JCiP, 2nd edition. Addison-Wesley, 2006. pp.109
Since:
2.6
  • Constructor Details

    • Memoizer

      public Memoizer()
  • Method Details

    • compute

      public V compute(ComputableTask<A,V> c, A taskArg) throws InterruptedException
      Description copied from interface: LowLevelProcessor
      Waits if necessary for the computation to complete, and then retrieves its result.
      Specified by:
      compute in interface LowLevelProcessor<A,V>
      Parameters:
      taskArg - argument for computation
      Throws:
      InterruptedException - if the current thread was interrupted while waiting
    • forget

      public void forget(ComputableTask<A,V> task, A key)
      Forgets result of the specified task. This allows to manually control size of internal cache.
      Parameters:
      task - computable task, forming part of result key
      key - argument of computation
    • forgetAll

      public void forgetAll()
      Forgets all cached results.