abstract class Connection implements ConnectionInterface

Abstract base class for pooled connections.

Provides common functionality for connection lifecycle management including release handling, health checking, and usage tracking.

Properties

protected float $lastUseTime
protected float $lastReleaseTime
protected bool $invalid

Methods

__construct(Container $container, PoolInterface $pool)

No description

void
release()

Release the connection back to the pool.

void
discard()

Discard the connection from its pool.

mixed
getConnection()

Get the underlying connection, with retry on failure.

bool
check()

Check if the connection is still valid based on idle time.

float
getLastUseTime()

Get the last use time.

float
getLastReleaseTime()

Get the last release time.

void
markInvalid()

Mark the connection as invalid.

void
markValid()

Mark the connection as valid.

mixed
getActiveConnection()

Get the active connection, reconnecting if necessary.

Details

at line 33
__construct(Container $container, PoolInterface $pool)

No description

Parameters

Container $container
PoolInterface $pool

at line 49
void release()

Release the connection back to the pool.

Return Value

void

at line 68
void discard()

Discard the connection from its pool.

Return Value

void

at line 76
mixed getConnection()

Get the underlying connection, with retry on failure.

Return Value

mixed

at line 90
bool check()

Check if the connection is still valid based on idle time.

Return Value

bool

at line 109
float getLastUseTime()

Get the last use time.

Return Value

float

at line 117
float getLastReleaseTime()

Get the last release time.

Return Value

float

at line 125
protected void markInvalid()

Mark the connection as invalid.

Return Value

void

at line 133
protected void markValid()

Mark the connection as valid.

Return Value

void

at line 141
abstract mixed getActiveConnection()

Get the active connection, reconnecting if necessary.

Return Value

mixed