class PoolManager implements Factory

Properties

protected ObjectPool> $pools
protected PoolDefinition> $definitions

Methods

getOrCreate(PoolDefinition $definition, callable $callback)

Get or create the pool registered for an immutable definition.

get(string $identity)

Get a managed pool by identity.

bool
has(string $identity)

Determine if a pool exists for an identity.

array
pools()

Get all registered pools keyed by identity.

definition(string $identity)

Get the definition registered for an identity.

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

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

void
flush()

Remove and close every registered pool.

string
diffOptions(PoolOptions $registered, PoolOptions $requested)

Describe only normalized pool-option differences.

Details

at line 23
ObjectPool getOrCreate(PoolDefinition $definition, callable $callback)

Get or create the pool registered for an immutable definition.

Parameters

PoolDefinition $definition
callable $callback

Return Value

ObjectPool

at line 72
ObjectPool get(string $identity)

Get a managed pool by identity.

Parameters

string $identity

Return Value

ObjectPool

at line 84
bool has(string $identity)

Determine if a pool exists for an identity.

Parameters

string $identity

Return Value

bool

at line 94
array pools()

Get all registered pools keyed by identity.

Return Value

array

at line 102
PoolDefinition|null definition(string $identity)

Get the definition registered for an identity.

Parameters

string $identity

Return Value

PoolDefinition|null

at line 110
bool remove(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 130
void flush()

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

at line 146
protected string diffOptions(PoolOptions $registered, PoolOptions $requested)

Describe only normalized pool-option differences.

Parameters

PoolOptions $registered
PoolOptions $requested

Return Value

string

Exceptions

JsonException