PHP 클래스 yii\web\CacheSession

The cache being used can be any cache application component. The ID of the cache application component is specified via [[cache]], which defaults to 'cache'. Beware, by definition cache storage are volatile, which means the data stored on them may be swapped out and get lost. Therefore, you must make sure the cache used by this component is NOT volatile. If you want to use database as storage medium, DbSession is a better choice. The following example shows how you can configure the application to use CacheSession: Add the following to your application config under components: php 'session' => [ 'class' => 'yii\web\CacheSession', 'cache' => 'mycache', ]
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\web\Session
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cache the cache object or the application component ID of the cache object. The session data will be stored using this cache object. After the CacheSession object is created, if you want to change this property, you should only assign it with a cache object. Starting from version 2.0.2, this can also be a configuration array for creating the object.

공개 메소드들

메소드 설명
destroySession ( string $id ) : boolean Session destroy handler.
getUseCustomStorage ( ) : boolean Returns a value indicating whether to use custom session storage.
init ( ) Initializes the application component.
readSession ( string $id ) : string Session read handler.
writeSession ( string $id, string $data ) : boolean Session write handler.

보호된 메소드들

메소드 설명
calculateKey ( string $id ) : mixed Generates a unique key used for storing session data in cache.

메소드 상세

calculateKey() 보호된 메소드

Generates a unique key used for storing session data in cache.
protected calculateKey ( string $id ) : mixed
$id string session variable name
리턴 mixed a safe cache key associated with the session variable name

destroySession() 공개 메소드

Do not call this method directly.
public destroySession ( string $id ) : boolean
$id string session ID
리턴 boolean whether session is destroyed successfully

getUseCustomStorage() 공개 메소드

This method overrides the parent implementation and always returns true.
public getUseCustomStorage ( ) : boolean
리턴 boolean whether to use custom storage.

init() 공개 메소드

Initializes the application component.
public init ( )

readSession() 공개 메소드

Do not call this method directly.
public readSession ( string $id ) : string
$id string session ID
리턴 string the session data

writeSession() 공개 메소드

Do not call this method directly.
public writeSession ( string $id, string $data ) : boolean
$id string session ID
$data string session data
리턴 boolean whether session write is successful

프로퍼티 상세

$cache 공개적으로 프로퍼티

the cache object or the application component ID of the cache object. The session data will be stored using this cache object. After the CacheSession object is created, if you want to change this property, you should only assign it with a cache object. Starting from version 2.0.2, this can also be a configuration array for creating the object.
public $cache