Header menu logo fantomas

WeakMap Module

Functions and values

Function or value Description

cacheConditionally shouldCache valueFactory

Full Usage: cacheConditionally shouldCache valueFactory

Parameters:
    shouldCache : 'Value -> bool
    valueFactory : 'Key -> 'Value

Returns: 'Key -> 'Value

Like getOrCreate, but only cache the value if it satisfies the given predicate.

shouldCache : 'Value -> bool
valueFactory : 'Key -> 'Value
Returns: 'Key -> 'Value

getOrCreate valueFactory

Full Usage: getOrCreate valueFactory

Parameters:
    valueFactory : 'Key -> 'Value

Returns: 'Key -> 'Value
 Provides association of lazily-created values with arbitrary key objects.
 The associated value is created on first request and kept alive only while the key
 is strongly referenced elsewhere (backed by ConditionalWeakTable).

 Usage:
   let getValueFor = WeakMap.getOrCreate (fun key -> expensiveInit key)
   let v = getValueFor someKey
valueFactory : 'Key -> 'Value
Returns: 'Key -> 'Value

Type something to start searching.