PHP Класс lithium\storage\Session

The Session layer of Lithium inherits from the common Adaptable class, which provides the generic configuration setting & retrieval logic, as well as the logic required to locate & instantiate the proper adapter class. In most cases, you will configure various named session configurations in your bootstrap process, which will then be available to you in all other parts of your application. Each adapter provides a consistent interface for the basic cache operations of write, read and delete, which can be used interchangably between all adapters. For more information on Session methods and specific adapters, please see their relevant documentation.
См. также: lithium\core\Adaptable
См. также: lithium\storage\session\adapter
Наследование: extends lithium\core\Adaptable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_adapters string A dot-separated path for use by Libraries::locate(). Used to look up the correct type of adapters for this class.
$_configurations array Stores configurations arrays for session adapters, keyed by configuration name.
$_strategies string Libraries::locate() compatible path to strategies for this class.

Открытые методы

Метод Описание
adapter ( string $name = null ) : object Returns the adapter object instance of the named configuration.
check ( string $key, array $options = [] ) : boolean Checks if a session key is set in any adapter, or if a particular adapter configuration is specified (via 'name' in $options), only that configuration is checked.
clear ( array $options = [] ) Clears all keys from a single adapter (if a 'name' options is specified) or all session adapters.
delete ( string $key, array $options = [] ) : boolean Deletes a named key from a single adapter (if a 'name' option is specified) or all session adapters.
isStarted ( string $name = null ) : boolean Indicates whether the the current request includes information on a previously started session.
key ( mixed $name = null, $sessionId = null ) : string Returns (and Sets) the key used to identify the session.
read ( string $key = null, array $options = [] ) : mixed Reads a value from a persistent session store.
write ( string $key, mixed $value = null, array $options = [] ) : boolean Writes a persistent value to one or more session stores.

Описание методов

adapter() публичный статический Метод

Returns the adapter object instance of the named configuration.
public static adapter ( string $name = null ) : object
$name string Named configuration. If not set, the last configured adapter object instance will be returned.
Результат object Adapter instance.

check() публичный статический Метод

Checks if a session key is set in any adapter, or if a particular adapter configuration is specified (via 'name' in $options), only that configuration is checked.
public static check ( string $key, array $options = [] ) : boolean
$key string The session key to check.
$options array Optional parameters that this method accepts.
Результат boolean

clear() публичный статический Метод

Clears all keys from a single adapter (if a 'name' options is specified) or all session adapters.
public static clear ( array $options = [] )
$options array Optional parameters that this method accepts: - `'name'` _string_: To force the write to a specific adapter, specify the name of the configuration (i.e. `'default'`) here. - `'strategies'` _boolean_: Indicates whether or not a configuration's applied strategy classes should be enabled for this operation. Defaults to `true`.

delete() публичный статический Метод

Deletes a named key from a single adapter (if a 'name' option is specified) or all session adapters.
public static delete ( string $key, array $options = [] ) : boolean
$key string The name of the session key to delete.
$options array Optional parameters that this method accepts: - `'name'` _string_: To force the delete to a specific adapter, specify the name of the configuration (i.e. `'default'`) here. - `'strategies'` _boolean_: Indicates whether or not a configuration's applied strategy classes should be enabled for this operation. Defaults to `true`.
Результат boolean Returns `true` on successful delete, or `false` on failure.

isStarted() публичный статический Метод

Indicates whether the the current request includes information on a previously started session.
public static isStarted ( string $name = null ) : boolean
$name string Optional named session configuration.
Результат boolean Returns `true` if a the request includes a key from a previously created session.

key() публичный статический Метод

Returns (and Sets) the key used to identify the session.
public static key ( mixed $name = null, $sessionId = null ) : string
$name mixed Optional named session configuration.
Результат string Returns the value of the session identifier key, or `null` if no named configuration exists, no session id has been set or no session has been started.

read() публичный статический Метод

Reads a value from a persistent session store.
public static read ( string $key = null, array $options = [] ) : mixed
$key string Key to be read.
$options array Optional parameters that this method accepts: - `'name'` _string_: To force the read from a specific adapter, specify the name of the configuration (i.e. `'default'`) here. - `'strategies'` _boolean_: Indicates whether or not a configuration's applied strategy classes should be enabled for this operation. Defaults to `true`.
Результат mixed Read result on successful session read, `null` otherwise.

write() публичный статический Метод

Writes a persistent value to one or more session stores.
public static write ( string $key, mixed $value = null, array $options = [] ) : boolean
$key string Key to be written.
$value mixed Data to be stored.
$options array Optional parameters that this method accepts: - `'name'` _string_: To force the write to a specific adapter, specify the name of the configuration (i.e. `'default'`) here. - `'strategies'` _boolean_: Indicates whether or not a configuration's applied strategy classes should be enabled for this operation. Defaults to `true`.
Результат boolean Returns `true` on successful write, `false` otherwise.

Описание свойств

$_adapters защищенное статическое свойство

A dot-separated path for use by Libraries::locate(). Used to look up the correct type of adapters for this class.
protected static string $_adapters
Результат string

$_configurations защищенное статическое свойство

Stores configurations arrays for session adapters, keyed by configuration name.
protected static array $_configurations
Результат array

$_strategies защищенное статическое свойство

Libraries::locate() compatible path to strategies for this class.
protected static string $_strategies
Результат string