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.
파일 보기
프로젝트 열기: unionofrad/lithium
1 사용 예제들
보호된 프로퍼티들
프로퍼티 |
타입 |
설명 |
|
$_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. |
|
메소드 상세
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. |
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.
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`. |
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. |
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. |
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. |
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. |
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 |
|