CodeIgniter v4.7 API

PersistsConnection

Trait for session handlers that need persistent connections.

Table of Contents

Properties

$connectionPool  : array<string, object>
Connection pool keyed by connection identifier.

Methods

resetPersistentConnections()  : void
Reset all persistent connections (useful for testing).
getConnectionIdentifier()  : string
Get connection identifier based on configuration.
getPersistentConnection()  : object|null
Get the persistent connection for this configuration.
hasPersistentConnection()  : bool
Check if a persistent connection exists for this configuration.
setPersistentConnection()  : void
Store a connection for persistence.

Properties

$connectionPool

Connection pool keyed by connection identifier.

protected static array<string, object> $connectionPool = []

Allows multiple configurations to each have their own connection.

Methods

resetPersistentConnections()

Reset all persistent connections (useful for testing).

public static resetPersistentConnections() : void

getConnectionIdentifier()

Get connection identifier based on configuration.

protected getConnectionIdentifier() : string

This returns a unique hash for each distinct connection configuration.

Return values
string

getPersistentConnection()

Get the persistent connection for this configuration.

protected getPersistentConnection() : object|null
Return values
object|null

hasPersistentConnection()

Check if a persistent connection exists for this configuration.

protected hasPersistentConnection() : bool
Return values
bool

setPersistentConnection()

Store a connection for persistence.

protected setPersistentConnection(object|null $connection) : void
Parameters
$connection : object|null

The connection to persist (null to clear).


        
On this page

Search results