class PooledConnection implements ConnectionInterface

Wraps a database Connection for use with Hypervel's connection pool.

This adapter implements Hypervel's pool ConnectionInterface, 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 $lifetimeExpiresAt
protected bool $availableForReuse
protected bool $invalid
protected Dispatcher|null $dispatcher

Methods

__construct(Container $container, DbPool $pool, array $config)

No description

mixed
getConnection()

Get the underlying database connection.

getActiveConnection()

Get the active connection, reconnecting if necessary.

bool
reconnect()

Reconnect to the database.

bool
check()

Check if the connection is still valid.

bool
isIdleExpired(float|null $now = null)

Determine if this connection has been idle long enough to be evicted.

bool
ping(float $timeout)

Ping already-open PDO connections.

bool
close()

Close the database connection.

void
release()

Release the connection back to the pool.

void
discard()

Discard the connection from its pool.

float
getLastUseTime()

Get the last use time.

float
getLastReleaseTime()

Get the last release time.

float
getCreatedAt()

Get the connection generation creation time.

bool
isLifetimeExpired(float|null $now = null)

Determine if this connection generation has reached its maximum lifetime.

bool
hasOpenTransaction()

Determine if the underlying connection has an open transaction.

void
markInvalid()

Mark the connection as invalid.

void
markValid()

Mark the connection as valid.

array
getOpenPdos()

Get already-open PDO instances.

static bool
pingPdos(array $pdos)

Ping PDO instances.

void
refresh(Connection $connection)

Refresh the PDO connections.

Details

at line 60
__construct(Container $container, DbPool $pool, array $config)

No description

Parameters

Container $container
DbPool $pool
array $config

at line 78
mixed getConnection()

Get the underlying database connection.

Return Value

mixed

at line 86
Connection getActiveConnection()

Get the active connection, reconnecting if necessary.

Return Value

Connection

at line 104
bool reconnect()

Reconnect to the database.

Return Value

bool

at line 158
bool check()

Check if the connection is still valid.

Return Value

bool

at line 190
bool isIdleExpired(float|null $now = null)

Determine if this connection has been idle long enough to be evicted.

Parameters

float|null $now

Return Value

bool

at line 202
bool ping(float $timeout)

Ping already-open PDO connections.

Parameters

float $timeout

Return Value

bool

at line 243
bool close()

Close the database connection.

Return Value

bool

at line 259
void release()

Release the connection back to the pool.

Return Value

void

at line 306
void discard()

Discard the connection from its pool.

Return Value

void

at line 314
float getLastUseTime()

Get the last use time.

Return Value

float

at line 322
float getLastReleaseTime()

Get the last release time.

Return Value

float

at line 330
float getCreatedAt()

Get the connection generation creation time.

Return Value

float

at line 338
bool isLifetimeExpired(float|null $now = null)

Determine if this connection generation has reached its maximum lifetime.

Parameters

float|null $now

Return Value

bool

at line 350
bool hasOpenTransaction()

Determine if the underlying connection has an open transaction.

Return Value

bool

at line 359
protected void markInvalid()

Mark the connection as invalid.

Return Value

void

at line 367
protected void markValid()

Mark the connection as valid.

Return Value

void

at line 377
protected array getOpenPdos()

Get already-open PDO instances.

Return Value

array

at line 403
static protected bool pingPdos(array $pdos)

Ping PDO instances.

Parameters

array $pdos

Return Value

bool

at line 441
protected void refresh(Connection $connection)

Refresh the PDO connections.

Parameters

Connection $connection

Return Value

void