The return type of the ResolveSeq instances
The key type
Optional context type
Creates a new KeyedResolvSeq instance.
Configuration options (key2string, ctx, lru)
Registers a callback that fires when a new item is added to the collection.
The callback is invoked after the item is created and stored. Multiple callbacks can be registered.
Callback function receiving the new item
Unregister function to remove the callback
Registers a callback that fires when an item is deleted from the collection.
The callback is invoked before the item is removed. This includes both explicit deletions and LRU evictions.
Callback function receiving the deleted item
Unregister function to remove the callback
Updates the LRU parameters of the underlying collection.
Allows dynamic adjustment of caching behavior without recreating the entire collection.
New parameters to apply (partial update)
Asynchronously gets or creates a value for a key resolved from a promise.
Useful when the key itself needs to be computed asynchronously, such as from a database lookup or API call.
Function returning a promise that resolves to the key
Promise resolving to the value
Checks if a key exists in the collection.
Does not create a new value if the key doesn't exist.
True if the key exists in the collection
Deletes an item from the collection.
Triggers onDelete callbacks before removal. The item will need to be recreated if accessed again.
The key to delete
Returns all keys currently in the collection.
Returns the original keys (givenKey), not the normalized string versions.
Array of all keys
Iterates over all items in the collection.
The callback receives each item and its index.
Callback function receiving item and index
Returns an iterable of all items with their indices.
Iterable of [item, index] pairs
Gets or creates the full KeyedNgItem for a given key.
Returns the complete item structure including key, value, and context. If the key doesn't exist, creates it using the factory function.
The complete KeyedNgItem
Gets or creates a value for the given key.
This is the primary method for accessing values. If the key doesn't exist, the factory function is called to create the value. Subsequent calls with the same key return the cached value.
The value associated with the key
Returns all items currently in the collection.
Returns complete KeyedNgItem objects, not just the values.
Array of all items
Keyed collection of ResolveSeq instances.
Manages a map of ResolveSeq instances indexed by keys, with optional LRU caching. Each key gets its own ResolveSeq instance for sequential execution of operations.
Example