Factory
interface Factory
Methods
Get or create a named pool.
Get or create the pool registered for an immutable definition.
Get a currently registered managed pool by identity.
Determine if a pool is currently registered for an identity.
Get all registered pools keyed by identity.
Get the definition currently registered for an identity.
Remove and close a pool when it still matches an optional expected instance.
Remove and close every registered pool.
Details
at line 19
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.
at line 28
ObjectPool
getOrCreate(PoolDefinition $definition, callable $createCallback)
Get or create the pool registered for an immutable definition.
at line 36
ObjectPool
get(string $identity)
Get a currently registered managed pool by identity.
at line 43
bool
has(string $identity)
Determine if a pool is currently registered for an identity.
This does not reserve registry membership across a coroutine yield.
at line 50
array
getPools()
Get all registered pools keyed by identity.
at line 55
PoolDefinition|null
getDefinition(string $identity)
Get the definition currently registered for an identity.
at line 60
bool
purge(string $identity, ObjectPool|null $expected = null)
Remove and close a pool when it still matches an optional expected instance.
at line 68
void
purgeAll()
Remove and close every registered pool.
This clears worker-lifetime pools shared by every coroutine; use targeted removal for runtime resource recovery.