public abstract class Memoize
extends java.lang.Object
Constructor and Description |
---|
Memoize() |
Modifier and Type | Method and Description |
---|---|
static <V> Closure<V> |
buildMemoizeFunction(MemoizeCache<java.lang.Object,java.lang.Object> cache,
Closure<V> closure)
Creates a new closure delegating to the supplied one and memoizing all return values by the arguments.
|
static <V> Closure<V> |
buildSoftReferenceMemoizeFunction(int protectedCacheSize,
MemoizeCache<java.lang.Object,java.lang.Object> cache,
Closure<V> closure)
Creates a new closure delegating to the supplied one and memoizing all return values by the arguments.
|
public static <V> Closure<V> buildMemoizeFunction(MemoizeCache<java.lang.Object,java.lang.Object> cache, Closure<V> closure)
V
- The closure's return typecache
- A map to hold memoized return valuesclosure
- The closure to memoizepublic static <V> Closure<V> buildSoftReferenceMemoizeFunction(int protectedCacheSize, MemoizeCache<java.lang.Object,java.lang.Object> cache, Closure<V> closure)
V
- The closure's return typeprotectedCacheSize
- The number of hard references to keep in order to prevent some (LRU) memoized return values from evictioncache
- A map to hold memoized return valuesclosure
- The closure to memoize