class PoolOption implements PoolOptionInterface

Configuration options for a connection pool.

Constants

MIN_LIFETIME_JITTER_BASIS

Lowest max_lifetime fraction assigned to a connection generation.

LIFETIME_JITTER_SCALE

Scale used for jitter basis values.

Methods

__construct(int $minConnections = 1, int $maxConnections = 10, float $connectTimeout = 10.0, float $waitTimeout = 3.0, float $heartbeat = -1, float $heartbeatTimeout = 1.0, float $maxIdleTime = 60.0, float $maxLifetime = -1.0, array $events = [])

No description

int
getMaxConnections()

Get the maximum number of connections in the pool.

setMaxConnections(int $maxConnections)

Set the maximum number of connections in the pool.

int
getMinConnections()

Get the managed-connection floor for excess-idle trimming.

setMinConnections(int $minConnections)

Set the managed-connection floor for excess-idle trimming.

float
getConnectTimeout()

Get the connection timeout in seconds.

setConnectTimeout(float $connectTimeout)

Set the timeout for establishing a connection.

float
getHeartbeat()

Get the heartbeat interval in seconds.

float
getHeartbeatTimeout()

Get the heartbeat timeout in seconds.

setHeartbeat(float $heartbeat)

Set the heartbeat interval in seconds.

setHeartbeatTimeout(float $heartbeatTimeout)

Set the heartbeat timeout in seconds.

float
getWaitTimeout()

Get the wait timeout in seconds for acquiring a connection.

setWaitTimeout(float $waitTimeout)

Set the timeout for waiting to get a connection from the pool.

float
getMaxIdleTime()

Get the maximum idle time in seconds before a connection is closed.

setMaxIdleTime(float $maxIdleTime)

Set the maximum idle time before a connection is closed.

float
getMaxLifetime()

Get the maximum lifetime in seconds before a connection is recycled.

static float
jitteredLifetimeDeadline(float $createdAt, float $maxLifetime)

Return a jittered lifetime deadline for a connection generation.

setMaxLifetime(float $maxLifetime)

Set the maximum lifetime in seconds before a connection is recycled.

array
getEvents()

Get the events to trigger on connection lifecycle.

setEvents(array $events)

Set the events to trigger on connection lifecycle.

Details

at line 36
__construct(int $minConnections = 1, int $maxConnections = 10, float $connectTimeout = 10.0, float $waitTimeout = 3.0, float $heartbeat = -1, float $heartbeatTimeout = 1.0, float $maxIdleTime = 60.0, float $maxLifetime = -1.0, array $events = [])

No description

Parameters

int $minConnections

Managed-connection floor when trimming excess idle connections

int $maxConnections

Maximum connections allowed in the pool

float $connectTimeout

Timeout in seconds for establishing a connection

float $waitTimeout

Timeout in seconds for waiting to get a connection from pool

float $heartbeat

Heartbeat interval in seconds (-1 to disable)

float $heartbeatTimeout

Heartbeat timeout in seconds

float $maxIdleTime

Maximum idle time in seconds before connection is closed

float $maxLifetime

Maximum lifetime in seconds before connection is recycled (-1 to disable)

array $events

Events to trigger on connection lifecycle

at line 57
int getMaxConnections()

Get the maximum number of connections in the pool.

Return Value

int

at line 69
PoolOption setMaxConnections(int $maxConnections)

Set the maximum number of connections in the pool.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

int $maxConnections

Return Value

PoolOption

at line 77
int getMinConnections()

Get the managed-connection floor for excess-idle trimming.

Return Value

int

at line 89
PoolOption setMinConnections(int $minConnections)

Set the managed-connection floor for excess-idle trimming.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

int $minConnections

Return Value

PoolOption

at line 97
float getConnectTimeout()

Get the connection timeout in seconds.

Return Value

float

at line 109
PoolOption setConnectTimeout(float $connectTimeout)

Set the timeout for establishing a connection.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $connectTimeout

Return Value

PoolOption

at line 117
float getHeartbeat()

Get the heartbeat interval in seconds.

Return Value

float

at line 122
float getHeartbeatTimeout()

Get the heartbeat timeout in seconds.

Return Value

float

at line 134
PoolOption setHeartbeat(float $heartbeat)

Set the heartbeat interval in seconds.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $heartbeat

Return Value

PoolOption

at line 149
PoolOption setHeartbeatTimeout(float $heartbeatTimeout)

Set the heartbeat timeout in seconds.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $heartbeatTimeout

Return Value

PoolOption

at line 157
float getWaitTimeout()

Get the wait timeout in seconds for acquiring a connection.

Return Value

float

at line 169
PoolOption setWaitTimeout(float $waitTimeout)

Set the timeout for waiting to get a connection from the pool.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $waitTimeout

Return Value

PoolOption

at line 177
float getMaxIdleTime()

Get the maximum idle time in seconds before a connection is closed.

Return Value

float

at line 189
PoolOption setMaxIdleTime(float $maxIdleTime)

Set the maximum idle time before a connection is closed.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $maxIdleTime

Return Value

PoolOption

at line 200
float getMaxLifetime()

Get the maximum lifetime in seconds before a connection is recycled.

Return Value

float

at line 208
static float jitteredLifetimeDeadline(float $createdAt, float $maxLifetime)

Return a jittered lifetime deadline for a connection generation.

Parameters

float $createdAt
float $maxLifetime

Return Value

float

at line 228
PoolOption setMaxLifetime(float $maxLifetime)

Set the maximum lifetime in seconds before a connection is recycled.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

float $maxLifetime

Return Value

PoolOption

at line 236
array getEvents()

Get the events to trigger on connection lifecycle.

Return Value

array

at line 248
PoolOption setEvents(array $events)

Set the events to trigger on connection lifecycle.

Boot-only. The value persists on the worker-lifetime pool option and is read by every subsequent pool operation. Per-request use races across coroutines.

Parameters

array $events

Return Value

PoolOption