interface Factory

Methods

pool(string $name, callable $createCallback, array $options = [])

Get or create a named pool.

getOrCreate(PoolDefinition $definition, callable $createCallback)

Get or create the pool registered for an immutable definition.

get(string $identity)

Get a currently registered managed pool by identity.

bool
has(string $identity)

Determine if a pool is currently registered for an identity.

array
getPools()

Get all registered pools keyed by identity.

getDefinition(string $identity)

Get the definition currently registered for an identity.

bool
purge(string $identity, ObjectPool|null $expected = null)

Remove and close a pool when it still matches an optional expected instance.

void
purgeAll()

Remove and close every registered pool.

Details

at line 18
ObjectPool pool(string $name, callable $createCallback, array $options = [])

Get or create a named pool.

The name declares construction equivalence: every callback used with it must construct an equivalent object. Resolve the pool each time you borrow, because idle managed pools may be removed and closed.

Parameters

string $name
callable $createCallback
array $options

Return Value

ObjectPool

at line 27
ObjectPool getOrCreate(PoolDefinition $definition, callable $createCallback)

Get or create the pool registered for an immutable definition.

Parameters

PoolDefinition $definition
callable $createCallback

Return Value

ObjectPool

at line 35
ObjectPool get(string $identity)

Get a currently registered managed pool by identity.

Parameters

string $identity

Return Value

ObjectPool

at line 42
bool has(string $identity)

Determine if a pool is currently registered for an identity.

This does not reserve registry membership across a coroutine yield.

Parameters

string $identity

Return Value

bool

at line 49
array getPools()

Get all registered pools keyed by identity.

Return Value

array

at line 54
PoolDefinition|null getDefinition(string $identity)

Get the definition currently registered for an identity.

Parameters

string $identity

Return Value

PoolDefinition|null

at line 59
bool purge(string $identity, ObjectPool|null $expected = null)

Remove and close a pool when it still matches an optional expected instance.

Parameters

string $identity
ObjectPool|null $expected

Return Value

bool

at line 67
void purgeAll()

Remove and close every registered pool.

Boot or tests only. This clears worker-lifetime pools shared by every coroutine; use targeted removal for runtime resource recovery.

Return Value

void