@param string $sessionId
@param string $data

@return bool
541147
public function write($sessionId, $data): bool
    {
        $filename = $this->savePath . \DIRECTORY_SEPARATOR . $this->prefix . $sessionId;

        return \file_put_contents($filename, $data) === false ? false : true;
    }
330571
protected function setSessionId($sessionId) {
    $session = ObjectFactory::getInstance('session');
    $sids = $session->get(self::SIDS_SESSION_VARNAME);
    $sids[$this->serverCli] = $sessionId;
    $session->set(self::SIDS_SESSION_VARNAME, $sids);
  }
1347765
protected function performInsert($sessionId, $payload)
    {
        try {
            return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId));
        } catch (QueryException $e) {
            $this->performUpdate($sessionId, $payload);
        }
    }
1328865
public function read(string $sessionId)
    {
        $file = "{$this->savePath}/{$this->sessionName}_{$sessionId}";
        if (!is_file($file)) {
            return false;
        }

        return $this->getObject(\PG\MSF\Coroutine\File::class)->goReadFile($file);
    }
568928
public function write( $sessionId, $sessionData )
    {
        $db = eZDB::instance();
        if ( !$db->isConnected() )
        {
            return false;
        }

        $ini = eZINI::instance();
        $expirationTime = time() + $ini->variable( 'Session', 'SessionTimeout' );

        if ( $db->bindingType() != eZDBInterface::BINDING_NO )
        {
            $sessionData = $db->bindVariable( $sessionData, array( 'name' => 'data' ) );
        }
        else
        {
            $sessionData = '\'' . $db->escapeString( $sessionData ) . '\'';
        }
        $escKey = $db->escapeString( $sessionId );
        $userID = $db->escapeString( eZSession::userID() );

        // check if session already exists
        $sessionRes = !$this->userHasCookie ? false : $db->arrayQuery( "SELECT session_key FROM ezsession WHERE session_key='$escKey'" );

        if ( $sessionRes !== false and count( $sessionRes ) == 1 )
        {
            $ret = $db->query( "UPDATE ezsession SET expiration_time='$expirationTime', data=$sessionData, user_id='$userID' WHERE session_key='$escKey'" );
        }
        else
        {
            $insertQuery = "INSERT INTO ezsession ( session_key, expiration_time, data, user_id )
                        VALUES ( '$escKey', '$expirationTime', $sessionData, '$userID' )";
            $ret = $db->query( $insertQuery );
        }
        return true;
    }
450156
public function startSession($sessionId = NULl){
        if($sessionId != NULL){ 
            session_id($sessionId);
        }
        session_start();
        $this->checkIdentity();
    }
1109444
public function write($session_id, $session_data)
	{
		// Skip session write on API and command line calls
		if ($this->skipWrites)
		{
			if ($this->profiler)
			{
				$this->profiler->mark('sessionStore');
			}
			return true;
		}

		// Get the database connection object and verify its connected.
		if ($this->connection->connected())
		{
			try
			{
				$query = $this->connection->getQuery()
					->update('#__session')
					->set(array(
						'data' => $session_data,
						'time' => (int) time(),
						'ip'   => $_SERVER['REMOTE_ADDR']
					))
					->whereEquals('session_id', $session_id);

				// Try to update the session data in the database table.
				$this->connection->setQuery($query->toString());

				if ($this->connection->execute())
				{
					if ($this->profiler)
					{
						$this->profiler->mark('sessionStore');
					}
					return true;
				}

				// Since $db->execute did not throw an exception, so the query was successful.
				// Either the data changed, or the data was identical.
				// In either case we are done.
			}
			catch (Exception $e)
			{
			}
		}

		if ($this->profiler)
		{
			$this->profiler->mark('sessionStore');
		}
		return false;
	}
351418
public function destroy($sessionId)
    {

        // delete the record associated with this id
        $sql = "DELETE FROM $this->table WHERE $this->idCol = :id";

        $stmt = $this->db->query($sql)
                    ->bind(':id', $sessionId)
                    ->execute();

        if ($stmt === false) {
            throw new Exception('Fail destroy session');
        }

        return true;
    }
706036
public function read($sessionId)
    {

        if (Config::get('session_user_loc') == 'db') {
            $result = $this->handler->get(Config::get('session_user_loc_table') . '-id-' . $sessionId, true, true, Config::get('session_user_loc_tableprefix'));
            return $result ? $result[0]['value'] : null;
        } else {
            $result = $this->handler->get(Config::get('session_user_loc_tableprefix') . Config::get('session_user_loc_table') . '-id-' . $sessionId);
            return $result ? $result : null;
        }
    }
592713
public function destroy($sessionID): bool
    {
        $where = ['session_id' => $sessionID];
        $query = $this->dbClass->prepare()->delete()->from($this->dbTable)->where($where);
        $result = $this->dbClass->execute($query) == 1 ? true : false;

        return $result;
    }
929330
public function do_write($session_id, $data, $ttl)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        $field_values = [
            'user_id' => $this->identity->getId(0),
            'client_ip' => $this->request->getClientIp(),
            'data' => $data,
            'updated_time' => time(),
            'expired_time' => $ttl + time()
        ];

        if ($db->query($this->_source)->exists()) {
            $db->update($this->_source, $field_values, ['session_id' => $session_id]);
        } else {
            $field_values['session_id'] = $session_id;
            $db->insert($this->_source, $field_values);
        }

        return true;
    }
655890
public function session_write($sessionId, $sessionData)
    {
        $sessionData       = (!$sessionData || !is_array($sessionData)) ? [] : $sessionData;
        $this->sessionData = (!$this->sessionData) ? [] : $this->sessionData;

        $this->sessionData = array_merge($sessionData, $this->sessionData);
        $this->engine->set($this->sessionKey . $sessionId, $this->sessionData, $this->sessionLifeTime);

        return true;
    }
530130
public function destroy($sessionId)
    {
        if ($this->_lock) {
            $query = $this->newQuery()
                ->where('id', $sessionId);
            if (!$query->delete()) {
                return $this->_fail();
            }
        }
        if ($this->close() === $this->_success) {
            $this->_cookie_destroy();
            return $this->_success;
        }

        return $this->_fail();
    }
6798
public function read($sessionId)
    {
        $this->sessionExpired = false;

        $selectSql = $this->getSelectSql();
        $selectStmt = $this->db->query($selectSql)
                        ->bind(':id', $sessionId);

        $sessionRows = $selectStmt->row();

        if ($sessionRows) {
            if ($sessionRows->{$this->timeCol} + $sessionRows->{$this->lifetimeCol} < time()) {
                $this->sessionExpired = true;

                return '';
            }

            return is_resource($sessionRows->{$this->dataCol}) ? stream_get_contents($sessionRows->{$this->dataCol}) : $sessionRows->{$this->dataCol};
        }

        return '';
    }
583684
public function start(string $sessionID = null)
    {
        if($this->isStart)
        {
            throw new \RuntimeException('Session can not repeated start');
        }
        $this->handler = RequestContext::getServerBean($this->handlerClass);
        $this->isNewSession = null === $sessionID;
        if($this->isNewSession)
        {
            $this->id = $this->handler->createSessionID();
        }
        else
        {
            $this->id = $sessionID;
            $this->data = $this->handler->decode($this->handler->read($this->id));
        }
        $this->isStart = true;
    }
314188
public function write($session_id, $session_data)
	{
		$key = $this->key($session_id);

		if ($this->engine->get($key . '_expire'))
		{
			$this->engine->replace($key . '_expire', time());
		}
		else
		{
			$this->engine->set($key . '_expire', time());
		}
		if ($this->engine->get($key))
		{
			$this->engine->replace($key, $session_data);
		}
		else
		{
			$this->engine->set($key, $session_data);
		}

		return;
	}
260372
protected function validateBrokerSessionId(string $sessionId)
    {
        $matches = null;

        if (!preg_match('/^SSO-(\w*+)-(\w*+)-([a-z0-9]*+)$/', $this->getBrokerSessionId(), $matches)) {
            $this->fail('Invalid session id');
        }

        if ($this->generateSessionId($matches[1], $matches[2]) != $sessionId) {
            $this->fail('Checksum failed: Client IP address may have changed');
        }

        return $matches[1];
    }