class File implements StoreInterface

File store.

Properties

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

Methods

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

Constructor.

Parameters

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

at line 67
protected string sessionFile(string $sessionId)

Returns the path to the session file.

Parameters

string $sessionId Session id

Return Value

string

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

Reads and returns session data.

Parameters

string $sessionId Session id

Return Value

array

at line 101
delete(string $sessionId)

Destroys the session data assiciated with the provided id.

Parameters

string $sessionId Session id

at line 112
gc(int $dataTTL)

Garbage collector that deletes expired session data.

Parameters

int $dataTTL Data TTL in seconds