Skip to content

EntityPoolOptions

Defined in: EntityPool.ts:31

Pool behaviour. TMax carries whether the pool is capped into acquire’s return type.

T extends PoolableEntity

TMax extends number | undefined = undefined

optional maxSize?: TMax

Defined in: EntityPool.ts:47

Upper bound on total members, leased and free together. Left out, the pool is elastic: it grows whenever every member is out and acquire always returns one. Set, a saturated acquire returns undefined and only forceAcquire still produces a member, by reclaiming one.


optional prewarm?: number

Defined in: EntityPool.ts:40

Members to construct up front, parked dormant. They run their constructor and setup(), never onAcquire — prewarming is not an acquisition.


optional reclaimPriority?: (member) => number

Defined in: EntityPool.ts:53

Victim selection for forceAcquire on a saturated pool: the leased member with the lowest value is taken, ties going to the one acquired longest ago. Default: oldest acquired.

T

number