class Redis implements StoreInterface

Redis store.

Properties

protected Redis $redis Redis client.
protected array|bool $classWhitelist Class whitelist.

Methods

__construct(Redis $redis, array|bool $classWhitelist = false)

Constructor.

write(string $sessionId, array $sessionData, int $dataTTL)

Writes session data.

array
read(string $sessionId)

Reads and returns session data.

delete(string $sessionId)

Destroys the session data assiciated with the provided id.

gc(int $dataTTL)

Garbage collector that deletes expired session data.

Details

at line 40
__construct(Redis $redis, array|bool $classWhitelist = false)

Constructor.

Parameters

Redis $redis Redis client
array|bool $classWhitelist Class whitelist

at line 50
write(string $sessionId, array $sessionData, int $dataTTL)

Writes session data.

Parameters

string $sessionId Session id
array $sessionData Session data
int $dataTTL TTL in seconds

at line 58
array read(string $sessionId)

Reads and returns session data.

Parameters

string $sessionId Session id

Return Value

array

at line 68
delete(string $sessionId)

Destroys the session data assiciated with the provided id.

Parameters

string $sessionId Session id

at line 76
gc(int $dataTTL)

Garbage collector that deletes expired session data.

Parameters

int $dataTTL Data TTL in seconds