LimitedCollection
classe · Source
A Collection which holds a max amount of entries and sweeps periodically.
Extends: Collection
Constructor
new LimitedCollection(options?: LimitedCollectionOptions, iterable?: Iterable)
Parameters
| Name | Type | Description |
|---|---|---|
options? | LimitedCollectionOptions | Options for constructing the Collection. Default: {}. |
iterable? | Iterable | Optional entries passed to the Map constructor. Default: null. |
Properties
maxSize
maxSize: number
The max size of the Collection. Source
keepOverLimit
keepOverLimit: function
A function called to check if an entry should be kept when the Collection is at max size. Source
sweepFilter
sweepFilter: SweepFilter
A function called every sweep interval that returns a function passed to sweep. Source
interval
interval: Timeout
The id of the interval being used to sweep. Source
Methods
filterByLifetime
filterByLifetime(options?: LifetimeFilterOptions): SweepFilter
Create a sweepFilter function that uses a lifetime to determine sweepability. Parameters
| Name | Type | Description |
|---|---|---|
options? | LifetimeFilterOptions | The options used to generate the filter function Default: {}. |
Returns: SweepFilterSource