class RedisSessionHandler extends NativeSessionHandler (View source)

Redis based session storage handler based on the Redis class provided by the PHP redis extension.

Properties

private $redis
private string $prefix

Methods

__construct(Redis|RedisArray|RedisCluster|Client $redis, array $options = array())

List of available options:

  • prefix: The prefix to use for the keys in order to avoid collision on the Redis server.

doRead($sessionId)

{@inheritdoc}

read($session_id)

{@inheritdoc}

doWrite($sessionId, $data)

{@inheritdoc}

write($session_id, $session_data)

{@inheritdoc}

destroy($session_id)

{@inheritdoc}

doDestroy($sessionId)

{@inheritdoc}

close()

{@inheritdoc}

gc($maxlifetime)

{@inheritdoc}

updateTimestamp($sessionId, $data)

{@inheritdoc}

Details

__construct(Redis|RedisArray|RedisCluster|Client $redis, array $options = array())

List of available options:

  • prefix: The prefix to use for the keys in order to avoid collision on the Redis server.

Parameters

Redis|RedisArray|RedisCluster|Client $redis
array $options

An associative array of options

Exceptions

InvalidArgumentException

protected doRead($sessionId)

{@inheritdoc}

Parameters

$sessionId

read($session_id)

{@inheritdoc}

Parameters

$session_id

protected doWrite($sessionId, $data)

{@inheritdoc}

Parameters

$sessionId
$data

write($session_id, $session_data)

{@inheritdoc}

Parameters

$session_id
$session_data

destroy($session_id)

{@inheritdoc}

Parameters

$session_id

protected doDestroy($sessionId)

{@inheritdoc}

Parameters

$sessionId

close()

{@inheritdoc}

gc($maxlifetime)

{@inheritdoc}

Parameters

$maxlifetime

updateTimestamp($sessionId, $data)

{@inheritdoc}

Parameters

$sessionId
$data