class CacheSessionHandler extends AbstractSessionHandler (View source)

Session save handler that stores session data in an in a PSR-16 cache.

Methods

protected
int
getLifetime()

Get the session lifetime in seconds.

protected
void
checkSessionID(string $id)

Check the PHP session ID i.e. PHPSESSID is valid against the default PHP session ID format.

public
__construct(CacheInterface $cache)

No description

public
bool
open(string $path, string $name)

No description

public
bool
close()

No description

public
bool
destroy(string $id)

No description

public
int|false
gc(int $max_lifetime)

No description

public
string|false
read(string $id)

No description

public
bool
write(string $id, string $data)

No description

public
bool
validateId(string $id)

No description

public
bool
updateTimestamp(string $id, string $data)

No description

Details

protected int getLifetime()

Get the session lifetime in seconds.

Returns the cookie lifetime if it's non-zero, otherwise returns the garbage collection lifetime.

Return Value

int

protected void checkSessionID(string $id)

Check the PHP session ID i.e. PHPSESSID is valid against the default PHP session ID format.

This is a security measure to prevent people from injecting invalid session IDs in the request.

This only needs to be called on read() We do not need to call this on write(), destroy(), updateTimestamp(), or validateId() as those methods are only called for session IDs that have already been accepted by PHP.

Parameters

string $id

Return Value

void

__construct(CacheInterface $cache)

No description

Parameters

CacheInterface $cache

bool open(string $path, string $name)

No description

Parameters

string $path
string $name

Return Value

bool

bool close()

No description

Return Value

bool

bool destroy(string $id)

No description

Parameters

string $id

Return Value

bool

int|false gc(int $max_lifetime)

No description

Parameters

int $max_lifetime

Return Value

int|false

string|false read(string $id)

No description

Parameters

string $id

Return Value

string|false

bool write(string $id, string $data)

No description

Parameters

string $id
string $data

Return Value

bool

bool validateId(string $id)

No description

Parameters

string $id

Return Value

bool

bool updateTimestamp(string $id, string $data)

No description

Parameters

string $id
string $data

Return Value

bool