public abstract class Memoize extends Object
Constructor and Description |
---|
Memoize() |
Modifier and Type | Method and Description |
---|---|
static <V> Closure<V> |
buildMemoizeFunction(MemoizeCache<Object,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<Object,SoftReference<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<Object,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<Object,SoftReference<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