ConnectionPool
in package
implements
ConnectionPoolInterface
FinalYes
Простой пул соединений с ключом protocol|endpoint.
Table of Contents
Interfaces
- ConnectionPoolInterface
- Пул повторно используемых соединений.
Methods
- __construct() : mixed
- acquire() : ConnectionInterface
- Берёт свободное соединение или создаёт новое.
- drain() : void
- Закрывает все соединения пула.
- release() : void
- Возвращает соединение в пул (если ещё открыто).
- size() : int
- Текущий размер пула (открытые слоты).
Methods
__construct()
public
__construct(ConnectionFactoryInterface $factory[, int $maxPerKey = 8 ]) : mixed
Parameters
- $factory : ConnectionFactoryInterface
-
Фабрика
- $maxPerKey : int = 8
-
Максимум idle на ключ
acquire()
Берёт свободное соединение или создаёт новое.
public
acquire(string $protocolId, string $endpoint[, ConnectionOptions|null $options = null ]) : ConnectionInterface
Parameters
- $protocolId : string
- $endpoint : string
- $options : ConnectionOptions|null = null
Attributes
- #[Override]
Return values
ConnectionInterfacedrain()
Закрывает все соединения пула.
public
drain() : void
Attributes
- #[Override]
release()
Возвращает соединение в пул (если ещё открыто).
public
release(ConnectionInterface $connection) : void
Parameters
- $connection : ConnectionInterface
Attributes
- #[Override]
size()
Текущий размер пула (открытые слоты).
public
size() : int
Attributes
- #[Override]