Session write handler.
Do not call this method directly.
@param string $id session ID
@param string $data session data
@return bool whether session write is successful
164472
public function writeSession($id, $data)
    {
        // exception must be caught in session write handler
        // http://us.php.net/manual/en/function.session-set-save-handler.php
        try {
            $this->db->getCollection($this->sessionCollection)->update(
                ['id' => $id],
                $this->composeFields($id, $data),
                ['upsert' => true]
            );
        } catch (\Exception $e) {
            Yii::$app->errorHandler->handleException($e);
            return false;
        }

        return true;
    }
441425
function write($id,$data) {
		$fw=Base::instance();
		$sent=headers_sent();
		$headers=$fw->get('HEADERS');
		$csrf=$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
			$fw->hash(mt_rand());
		$jar=$fw->get('JAR');
		if ($id!=$this->sid)
			$this->sid=$id;
		Cache::instance()->set($id.'.@',
			array(
				'data'=>$data,
				'csrf'=>$sent?$this->csrf():$csrf,
				'ip'=>$fw->get('IP'),
				'agent'=>isset($headers['User-Agent'])?
					$headers['User-Agent']:'',
				'stamp'=>time()
			),
			$jar['expire']?($jar['expire']-time()):0
		);
		return TRUE;
	}
777274
public function write($id , $data) {
    $crypto = $this->psl['crypt/crypto'];
    $store  = $this->psl['store'];

    /* Encrypt session. */
    try {
      $crypto->_algo = $this->cryptAlgo;
      $crypto->_mode = $this->cryptMode;
      $encrypted = $crypto->encrypt($data, $this->secret);

      /* Destroy old session. */
      if($this->newID != $this->currID) {
        $this->destroy($this->currID);
      }

      /* Write new session, with new ID. */
      return $store->write('session', $this->newID, $encrypted);
    } catch (\phpSec\Exception $e) {
      return false;
    }
  }
802603
public function save($id, $data)
    {
        $file = $this->getFilename($id);

        if (!$this->isWritable($file)) {
            throw new NotWritableException(sprintf('File could not be written to system as target is not writable: %s', $file));
        }

        if ($this->writeData($file, $data) === false) {

            $this->delete($file);

            throw new NotWritableException(sprintf('Data could not be written to file on system. Please make sure that file is writeable: %s', $file));
        }

        return $file;
    }
295331
public function write(
        /*# string */ $session_id,
        /*# string */ $session_data
    )/*# : bool */ {
        $file = $this->getSessionFile($session_id);
        return $this->storage->put($file, $session_data);
    }
1183516
public function write($id, $data) {
        if (headers_sent() && !$this->sent)
            throw new \LogicException('Session data must be written before headers are sent');
        if (!$this->sent) {
            $expires = null;
            if ($ttl = $this->getLifetime()) {
                $expires = time() + $ttl;
            }
            $this->sent = setcookie(
                $this->name,
                $this->getCipher()->encrypt($data),
                $expires,
                '/',
                $this->getDomain(),
                null,
                true
            );
        }
        return (bool) $this->sent;
    }
601780
public function handler_write($id, $data) {
        if (is_null($this->connection)) {
            // The session has already been closed, don't attempt another write.
            error_log('Tried to write session: '.$id.' before open or after close.');
            return false;
        }

        // We do not do locking here because memcached doesn't.  Also
        // PHP does open, read, destroy, write, close. When a session doesn't exist.
        // There can be race conditions on new sessions racing each other but we can
        // address that in the future.
        try {
            $this->connection->setex($id, $this->timeout, $data);
        } catch (RedisException $e) {
            error_log('Failed talking to redis: '.$e->getMessage());
            return false;
        }
        return true;
    }
984404
public function add($id, $data = 1)
    {
        try {
            return $this->resource->hSet(static::CACHE_KEY, $id, $data);
        } catch (ConnectionException $e) {
            return false;
        }
    }
893209
public function writeSession($id, $data)
    {
        // exception must be caught in session write handler
        // http://us.php.net/manual/en/function.session-set-save-handler.php#refsect1-function.session-set-save-handler-notes
        try {
            $fields = $this->composeFields($id, $data);
            $fields = $this->typecastFields($fields);
            $this->db->createCommand()->upsert($this->sessionTable, $fields)->execute();
        } catch (\Exception $e) {
            Yii::getApp()->errorHandler->handleException($e);
            return false;
        }

        return true;
    }
434877
public function send($data, $id = null)
    {
        if (!isset($id)) {
            $id = $this->lastId++;
        }
        $this->putLine('id: ' . $id);
        $this->putLine('data: ' . $data);
        $this->putLine();
        $this->flush();
    }
1322659
public function write($id, $data)
    {
        if (!$id) {
            return false;
        }

        return (bool)Cache::write($id, $data, $this->_options['config']);
    }
1018782
public function write($id, $data)
    {
        // Only store session to disk if data exists or session already
        // existed before (in last case we always want to touch the file
        // to prevent early garbage collection)
        // Note: This logic can be overwritten by the force flag
        if ($data
            || $this->exists
            || $this->force
        ) {
            $file = $this->getPathForSessionId($id);
            file_put_contents($file, $data);
            chmod($file, 0600);
            $this->exists = true;
        }

        return true;
    }
400701
function write($id,$data) {
		$this->set('session_id',$id);
		$this->set('data',$data);
		$this->set('ip',$this->_ip);
		$this->set('agent',$this->_agent);
		$this->set('stamp',time());
		$this->save();
		return TRUE;
	}
1323194
public function write($id, $sessionData)
    {
        $this->repository->set("{$this->prefix}{$id}", $sessionData, $this->maxLifetime / 60);
        return true;
    }
1098135
public function writeSession($id,$data)
	{
		return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout());
	}
957015
public function write($id, $data)
    {
        $sql = 'INSERT INTO ' . $this->config['name']
            . ' (' . $this->config['primary'] . ','
            . $this->config['modifiedColumn'] . ','
            . $this->config['lifetimeColumn'] . ','
            . $this->config['dataColumn'] . ')'
            . ' VALUES (?,?,?,?)'
            . ' ON DUPLICATE KEY UPDATE '
            . $this->config['modifiedColumn'] . ' = ?,'
            . $this->config['lifetimeColumn'] . ' = ?,'
            . $this->config['dataColumn'] . ' = ?';

        $this->query($sql, array($id, time(), $this->maxLifetime, $data, time(), $this->maxLifetime, $data));

        return true;
    }
868720
public function write($sessionId, $data): bool
    {
        $cryptedData = $this->encrypt($data);

        return parent::write($sessionId, $cryptedData);
    }