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
All Methods Instance Methods Concrete Methods 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, untilinvalidate()
is invoked.void
initialize(InvalidationEventHub hub)
Forcesinvalidate()
to be invoked when the hub emits an invalidation callback.void
invalidate()
Invalidates any existingcreate(org.apache.tapestry5.ioc.Invokable)
wrappers} such that they will re-perform the computation when next invoked.
-
-
-
Constructor Detail
-
RecomputableSupport
public RecomputableSupport()
-
-
Method Detail
-
invalidate
public void invalidate()
Invalidates any existingcreate(org.apache.tapestry5.ioc.Invokable)
wrappers} such that they will re-perform the computation when next invoked.
-
initialize
public void initialize(InvalidationEventHub hub)
Forcesinvalidate()
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, untilinvalidate()
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
-
-