redisClusterSessionHandler
extends redisSessionHandler
in package
Table of Contents
- $_config : array<string|int, mixed>
- $_redis : Redis
- __construct() : mixed
- redisSessionHandler constructor.
- close() : bool
- Close the session
- connect() : mixed
- destroy() : bool
- Destroy a session
- gc() : bool
- Cleanup old sessions
- open() : bool
- Initialize session
- read() : string
- Read session data
- updateTimestamp() : bool
- Update sesstion modify time.
- write() : bool
- Write session data
Properties
$_config
protected
array<string|int, mixed>
$_config
$_redis
protected
Redis
$_redis
Methods
__construct()
redisSessionHandler constructor.
public
__construct(mixed $config) : mixed
Parameters
- $config : mixed
-
= [ 'host' => '127.0.0.1', 'port' => 6379, 'timeout' => 2, 'auth' => '******', 'database' => 2, 'prefix' => 'redis_session_', 'ping' => 55, ]
Tags
Return values
mixed —close()
Close the session
public
close() : bool
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
connect()
public
connect() : mixed
Return values
mixed —destroy()
Destroy a session
public
destroy(string $session_id) : bool
Parameters
- $session_id : string
-
The session ID being destroyed.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
gc()
Cleanup old sessions
public
gc(int $maxlifetime) : bool
Parameters
- $maxlifetime : int
-
Sessions that have not updated for the last maxlifetime seconds will be removed.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
open()
Initialize session
public
open(string $save_path, string $name) : bool
Parameters
- $save_path : string
-
The path where to store/retrieve the session.
- $name : string
-
The session name.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
read()
Read session data
public
read(string $session_id) : string
Parameters
- $session_id : string
-
The session id to read data for.
Return values
string —Returns an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing.
updateTimestamp()
Update sesstion modify time.
public
updateTimestamp(string $id[, string $data = "" ]) : bool
Parameters
- $id : string
-
session id.
- $data : string = ""
-
session Data.
Return values
bool —write()
Write session data
public
write(string $session_id, string $session_data) : bool
Parameters
- $session_id : string
-
The session id.
- $session_data : string
-
The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized string and passing it as this parameter. Please note sessions use an alternative serialization method.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.