final class PhpRedisSessionClient implements RedisSessionClientInterface (View source)

internal  
 

Normalizes phpredis return values for the session storage lifecycle.

Methods

Creates the native client only when the optional Redis extension is available.

bool
connect(string $host, int $port, float $timeout)

Opens the native Redis connection.

bool
bool
authenticate(string $password)

Authenticates the native Redis connection.

bool
bool
selectDatabase(int $database)

Selects the configured logical Redis database.

bool
string|null
get(string $key)

Returns only string payloads and maps absent keys to null.

string|null
bool
exists(string $key)

Normalizes phpredis integer and boolean existence replies.

bool
bool
expire(string $key, int $seconds)

Reports whether Redis renewed the requested key.

bool
bool
setex(string $key, int $seconds, string $payload)

Stores the payload only when phpredis confirms success.

bool
bool
delete(string $key)

Treats both deletion and an already absent key as a successful command.

bool
void
close()

Closes the native connection without exposing its return convention.

void

Details

__construct

__construct()

Creates the native client only when the optional Redis extension is available.

connect

bool connect(string $host, int $port, float $timeout)

Opens the native Redis connection.

Parameters

string $host
int $port
float $timeout

Return Value

bool

authenticate

bool authenticate(string $password)

Authenticates the native Redis connection.

Parameters

string $password

Return Value

bool

selectDatabase

bool selectDatabase(int $database)

Selects the configured logical Redis database.

Parameters

int $database

Return Value

bool

get

string|null get(string $key)

Returns only string payloads and maps absent keys to null.

Parameters

string $key

Return Value

string|null

exists

bool exists(string $key)

Normalizes phpredis integer and boolean existence replies.

Parameters

string $key

Return Value

bool

expire

bool expire(string $key, int $seconds)

Reports whether Redis renewed the requested key.

Parameters

string $key
int $seconds

Return Value

bool

setex

bool setex(string $key, int $seconds, string $payload)

Stores the payload only when phpredis confirms success.

Parameters

string $key
int $seconds
string $payload

Return Value

bool

delete

bool delete(string $key)

Treats both deletion and an already absent key as a successful command.

Parameters

string $key

Return Value

bool

close

void close()

Closes the native connection without exposing its return convention.

Return Value

void