Session
Session
Session cache backend class
The session cache backend class allows access to a PHP session using standard class access methods. It will automatically start a session if one is not already started. Sessions can be namespaced to prevent variable collisions.
Available config options:
- lifetime - The lifetime to use for cached data. Default: 3600.
- session - Any settings to set on the session instance.
Properties
weight
protected int $weight
timeout
private int $timeout
values
private array $values
started
private bool $started
Methods
available
public available({Array})
init
public init({Array})
The session backend init method is responsible for maintaining a valid session. If a session has not already been started it will configure and start one automatically. You can specify a namespace for the session. The constructor will also maintain any timeouts for values as per the application configuration.
Parameters
Parameter | Type | Description |
---|---|---|
$namespace | string | The namespace to use for this session |
close
public close({Array})
has
public has({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | |
$check_empty | bool |
get
Return the value with key $key, optionally setting a default in the process.
public get({Array})
If $default is supplied and no value for $key is currently set in the session then the default value will be set in the session and then returned.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string |
set
public set({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$timeout | int |
remove
public remove({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string |
clear
public clear({Array})
Clears all values from all applications.
This equates to a full session reset.
extend
public extend({Array})
toArray
public toArray({Array})
count
public count({Array})
load
private load({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string |
Generated by Hazaar API Doc Generator