class File implements StoreInterface

File store.

Properties

protected FileSystem $fileSystem File system instance.
protected string $sessionPath Session path.
protected array|bool $classWhitelist Class whitelist.

Methods

__construct(FileSystem $fileSystem, string $sessionPath, array|bool $classWhitelist = false)

Constructor.

string
sessionFile(string $sessionId)

Returns the path to the session file.

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 50
__construct(FileSystem $fileSystem, string $sessionPath, array|bool $classWhitelist = false)

Constructor.

Parameters

FileSystem $fileSystem File system instance
string $sessionPath Session path
array|bool $classWhitelist Class whitelist

at line 65
protected string sessionFile(string $sessionId)

Returns the path to the session file.

Parameters

string $sessionId Session id

Return Value

string

at line 73
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 84
array read(string $sessionId)

Reads and returns session data.

Parameters

string $sessionId Session id

Return Value

array

at line 99
delete(string $sessionId)

Destroys the session data assiciated with the provided id.

Parameters

string $sessionId Session id

at line 110
gc(int $dataTTL)

Garbage collector that deletes expired session data.

Parameters

int $dataTTL Data TTL in seconds