Std.LruCache.getOrCompute
1 declaration
fn
getOrCompute: &Std.LruCache.LruCache[K, V] -> K -> fn(K) -> V -> (V, Std.LruCache.LruCache[K, V])This is a callable function.
What it does
The value under a key, computing and storing it when it is absent.
The reason a cache exists, in one call: the caller says what the value would
be if it had to be made, and gets back the value and the cache that now
holds it. The function is not called when the key is already present, which
is the saving being asked for.
Read the signature
- The text after the name is the type checked by Pudu.
- Read arrows from left to right: inputs come first, and the final type is returned.
- & borrows a value for this call instead of moving or copying it.
- Names inside [ ] are type arguments, such as the item type held by a collection.
