PooledConnection
class PooledConnection implements Connection
Wraps a database Connection for use with Hypervel's connection pool.
This adapter implements Hypervel's pool connection contract, allowing our Laravel-ported Connection to work with Hypervel's pooling infrastructure.
Constants
| protected MAX_ERROR_COUNT |
Maximum allowed errors before marking connection as stale. |
Properties
| protected Connection|null | $connection | ||
| protected ConnectionFactory | $factory | ||
| protected LoggerInterface | $logger | ||
| protected float | $lastUseTime | ||
| protected float | $lastReleaseTime | ||
| protected float | $createdAt | ||
| protected float|null | $lifetimeExpiresAt | ||
| protected bool | $availableForReuse | ||
| protected bool | $invalid | ||
| protected bool | $connectionEstablishedEventPending |
Methods
Create a new pooled connection instance.
Get the underlying database connection.
Get the active connection, reconnecting if necessary.
Reconnect to the database.
Notify listeners after the resolver has registered the connection.
Check if the connection is still valid.
Determine if this connection has been idle long enough to be evicted.
Ping the underlying database connection.
Close the database connection.
Release the connection back to the pool.
Discard the connection from its pool.
Get the last use time.
Get the last release time.
Get the connection generation creation time.
Determine if this connection generation has reached its maximum lifetime.
Determine if the underlying connection has an open transaction.
Mark the connection as invalid.
Mark the connection as valid.
Details
at line 61
__construct(Container $container, DatabasePool $pool, array $config)
Create a new pooled connection instance.
at line 75
mixed
getConnection()
Get the underlying database connection.
at line 83
Connection
getActiveConnection()
Get the active connection, reconnecting if necessary.
at line 101
bool
reconnect()
Reconnect to the database.
at line 161
void
dispatchConnectionEstablishedEvent()
| internal |
Notify listeners after the resolver has registered the connection.
at line 184
bool
check()
Check if the connection is still valid.
at line 216
bool
isIdleExpired(float|null $now = null)
Determine if this connection has been idle long enough to be evicted.
at line 230
bool
ping(float $timeout)
Ping the underlying database connection.
at line 304
bool
close()
Close the database connection.
at line 324
void
release()
Release the connection back to the pool.
at line 415
void
discard()
Discard the connection from its pool.
at line 423
float
getLastUseTime()
Get the last use time.
at line 431
float
getLastReleaseTime()
Get the last release time.
at line 439
float
getCreatedAt()
Get the connection generation creation time.
at line 447
bool
isLifetimeExpired(float|null $now = null)
Determine if this connection generation has reached its maximum lifetime.
at line 459
bool
hasOpenTransaction()
Determine if the underlying connection has an open transaction.
at line 468
protected void
markInvalid()
Mark the connection as invalid.
at line 476
protected void
markValid()
Mark the connection as valid.
at line 493
protected void
refresh(Connection $connection)
Refresh the database connection resources.