org.jetbrains.jet.storage
Interface StorageManager
- All Known Subinterfaces:
- LazyResolveStorageManager
- All Known Implementing Classes:
- LockBasedLazyResolveStorageManager, LockBasedStorageManager
public interface StorageManager
Method Summary |
|
compute(jet.Function0<T> computable)
|
|
createLazyValue(jet.Function0<T> computable)
|
|
createLazyValueWithPostCompute(jet.Function0<T> computable,
jet.Function1<java.lang.Boolean,T> onRecursiveCall,
jet.Function1<T,jet.Unit> postCompute)
|
|
createMemoizedFunction(jet.Function1<K,V> compute)
Given a function compute: K -> V create a memoized version of it that computes a value only once for each key |
|
createMemoizedFunctionWithNullableValues(jet.Function1<K,V> compute)
|
|
createNullableLazyValue(jet.Function0<T> computable)
|
|
createNullableLazyValueWithPostCompute(jet.Function0<T> computable,
jet.Function1<T,jet.Unit> postCompute)
postCompute is called after the value is computed, but before any other thread sees it (the current thread may
see it in between) |
|
createRecursionTolerantLazyValue(jet.Function0<T> computable,
T onRecursiveCall)
|
|
createRecursionTolerantNullableLazyValue(jet.Function0<T> computable,
T onRecursiveCall)
|
createMemoizedFunction
@NotNull
<K,V> MemoizedFunctionToNotNull<K,V> createMemoizedFunction(@NotNull
jet.Function1<K,V> compute)
- Given a function compute: K -> V create a memoized version of it that computes a value only once for each key
- Parameters:
compute
- the function to be memoizedvaluesReferenceKind
- how to store the memoized values
NOTE: if compute() has side-effects the WEAK reference kind is dangerous: the side-effects will be repeated if
the value gets collected and then re-computed
createMemoizedFunctionWithNullableValues
@NotNull
<K,V> MemoizedFunctionToNullable<K,V> createMemoizedFunctionWithNullableValues(@NotNull
jet.Function1<K,V> compute)
createLazyValue
@NotNull
<T> NotNullLazyValue<T> createLazyValue(@NotNull
jet.Function0<T> computable)
createRecursionTolerantLazyValue
@NotNull
<T> NotNullLazyValue<T> createRecursionTolerantLazyValue(@NotNull
jet.Function0<T> computable,
@NotNull
T onRecursiveCall)
createLazyValueWithPostCompute
@NotNull
<T> NotNullLazyValue<T> createLazyValueWithPostCompute(@NotNull
jet.Function0<T> computable,
@Nullable
jet.Function1<java.lang.Boolean,T> onRecursiveCall,
@NotNull
jet.Function1<T,jet.Unit> postCompute)
- Parameters:
onRecursiveCall
- is called if the computation calls itself recursively.
The parameter to it is true
for the first call, false
otherwise.
If onRecursiveCall
is null
, an exception will be thrown on a recursive call,
otherwise it's executed and its result is returnedpostCompute
- is called after the value is computed, but before any other thread sees it
createNullableLazyValue
@NotNull
<T> NullableLazyValue<T> createNullableLazyValue(@NotNull
jet.Function0<T> computable)
createRecursionTolerantNullableLazyValue
@NotNull
<T> NullableLazyValue<T> createRecursionTolerantNullableLazyValue(@NotNull
jet.Function0<T> computable,
@Nullable
T onRecursiveCall)
createNullableLazyValueWithPostCompute
@NotNull
<T> NullableLazyValue<T> createNullableLazyValueWithPostCompute(@NotNull
jet.Function0<T> computable,
@NotNull
jet.Function1<T,jet.Unit> postCompute)
postCompute
is called after the value is computed, but before any other thread sees it (the current thread may
see it in between)
compute
<T> T compute(@NotNull
jet.Function0<T> computable)