Package org.apache.tapestry5.internal.util

# Class RecomputableSupport

java.lang.Object
org.apache.tapestry5.internal.util.RecomputableSupport

public class RecomputableSupport extends Object
A utility class for managing a cacheable result that can be recomputed when needed.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RecomputableSupport()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> Invokable<T>`
  `create(Invokable<T> invokable)`
  Wraps a computation with caching logic; once computed, the Invokable will return the same value, until `invalidate()` is invoked.
  `void`
  `initialize(InvalidationEventHub hub)`
  Forces `invalidate()` to be invoked when the hub emits an invalidation callback.
  `void`
  `invalidate()`
  Invalidates any existing `create(org.apache.tapestry5.ioc.Invokable)` wrappers} such that they will re-perform the computation when next invoked.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RecomputableSupport

    public RecomputableSupport()

- ## Method Details

  - ### invalidate

    public void invalidate()
    Invalidates any existing `create(org.apache.tapestry5.ioc.Invokable)` wrappers} such that they will re-perform the computation when next invoked.

  - ### initialize

    public void initialize(InvalidationEventHub hub)
    Forces `invalidate()` to be invoked when the hub emits an invalidation callback.
    Parameters:
      `hub` -

  - ### create

    public <T> Invokable<T> create(Invokable<T> invokable)
    Wraps a computation with caching logic; once computed, the Invokable will return the same value, until `invalidate()` is invoked.
    Type Parameters:
      `T` - type of result
    Parameters:
      `invokable` - a computation to perform, whose results are cacheable until invalidated
    Returns:
      caching-enabled wrapper around invokable