LimitedCollection
Collection with optional FIFO eviction when a new key is inserted at capacity. Construction is Map-safe: options are never passed to `super()`, so subclasses can call `super({ maxSize, onEvict })` without Map treating the options object as an iterable.
Extends Collection
Constructor
(options: LimitedCollectionOptions<, >)| Param | Type | Description |
|---|---|---|
| options | LimitedCollectionOptions<, > |
Properties
: boolean (readonly)Whether this collection enforces a finite capacity.
: number (readonly): ((key: , value: ) => void) | null (readonly)Methods
(): LimitedCollection<, >Clone into a new LimitedCollection with the same limits (no `onEvict` callback).
(key: , value: ): thisInsert or update an entry. When at capacity and `key` is new, the oldest entry is removed (FIFO by Map insertion order) and `onEvict` is invoked if set.
| Param | Type | Description |
|---|---|---|
| key | K | |
| value | V |
(filter?: (value: , key: ) => boolean): numberRemove entries matching `filter` (or all if omitted). Returns count removed. Does not invoke `onEvict` — callers that need cascade teardown should handle it.
| Param | Type | Description |
|---|---|---|
| filter? | (value: , key: ) => boolean |