RedisPool
class RedisPool extends Pool
Properties
| protected Channel | $channel | from Pool | |
| protected PoolOptionInterface | $option | from Pool | |
| protected array<int, true> | $managedConnections | from Pool | |
| protected array<int, true> | $borrowedConnections | from Pool | |
| protected int | $creating | from Pool | |
| protected bool | $closed | from Pool | |
| protected FrequencyInterface|LowFrequencyInterface|null | $frequency | from Pool | |
| protected array | $config | ||
| protected Timer|null | $heartbeatTimer | ||
| protected int|null | $heartbeatTimerId |
Methods
Close idle connections while the total managed count exceeds the configured minimum.
Close the Redis pool and clear its shared resources.
Get the number of connections currently available in the pool.
Create a new pooled Redis connection.
Return an idle connection without changing its activity timestamps.
Destroy a managed connection and release its capacity.
Convert seconds to nanoseconds without overflowing integer arithmetic.
Build a monotonic deadline without overflowing at long durations or uptimes.
Get the Redis connection configuration.
Start the heartbeat timer if configured.
Clear the heartbeat timer.
Run one heartbeat sweep over currently idle connections.
Details
at line 30
__construct(Container $container, string $name)
Create a new Redis pool instance.
in
Pool at line 54
string
getName()
Get the pool name.
in
Pool at line 62
ConnectionInterface
get()
Get a connection from the pool.
in
Pool at line 92
void
release(ConnectionInterface $connection)
Release a connection back to the pool.
in
Pool at line 109
void
discard(ConnectionInterface $connection)
Discard a borrowed connection from the pool.
in
Pool at line 118
void
flush()
Close idle connections while the total managed count exceeds the configured minimum.
in
Pool at line 133
void
checkIdleConnection()
Check one idle connection and discard it when unhealthy.
at line 71
void
close()
Close the Redis pool and clear its shared resources.
in
Pool at line 189
bool
isClosed()
Determine if the pool is closed.
in
Pool at line 197
int
getCurrentConnections()
Get the current number of connections managed by the pool.
in
Pool at line 205
PoolOptionInterface
getOption()
Get the pool configuration options.
in
Pool at line 213
int
getConnectionsInChannel()
Get the number of connections currently available in the pool.
in
Pool at line 221
protected void
initOption(array $options = [])
Initialize pool options from configuration.
at line 59
protected ConnectionInterface
createConnection()
Create a new pooled Redis connection.
in
Pool at line 267
protected ConnectionInterface|false
popIdleConnection()
Pop and validate one idle connection.
in
Pool at line 291
protected void
requeueConnection(ConnectionInterface $connection)
Return an idle connection without changing its activity timestamps.
in
Pool at line 309
protected void
destroyConnection(ConnectionInterface $connection)
Destroy a managed connection and release its capacity.
in
Pool at line 333
protected void
report(Throwable|string $error)
Report a pool maintenance or cleanup failure without throwing.
in
Pool at line 344
protected StdoutLoggerInterface|null
getLogger()
Get the logger instance if available.
in
Pool at line 431
protected int
nanoseconds(float $seconds)
Convert seconds to nanoseconds without overflowing integer arithmetic.
in
Pool at line 441
protected int
deadline(float $seconds)
Build a monotonic deadline without overflowing at long durations or uptimes.
at line 51
array
getConfig()
Get the Redis connection configuration.
at line 85
protected void
startHeartbeat()
Start the heartbeat timer if configured.
at line 108
protected void
clearHeartbeat()
Clear the heartbeat timer.
at line 121
protected void
heartbeat()
Run one heartbeat sweep over currently idle connections.
at line 140
protected void
heartbeatConnection(RedisConnection $connection)
Heartbeat one idle connection.
at line 181
protected void
discardHeartbeatConnection(RedisConnection $connection)
Discard an idle connection from the pool.