yii\web\CacheSession::readSession PHP Method

readSession() public method

Do not call this method directly.
public readSession ( string $id ) : string
$id string session ID
return string the session data
    public function readSession($id)
    {
        $data = $this->cache->get($this->calculateKey($id));
        return $data === false ? '' : $data;
    }

Usage Example

Example #1
0
 public function testCacheSession()
 {
     $session = new CacheSession();
     $session->writeSession('test', 'sessionData');
     $this->assertEquals('sessionData', $session->readSession('test'));
     $session->destroySession('test');
     $this->assertEquals('', $session->readSession('test'));
 }