Writes session data to the database store

@param type $userdata
@param type $splash
@param type $session
@param type $sessionId
@param type $expiry
420450
public function write($userdata, $splash, $session, $sessionId, $expiry)
    {

        $database = $this->database;

        $database->insert($session->table, array(
            "session_key" => $database->quote($sessionId),
            "session_ip" => $database->quote($splash['ip']),
            "session_host" => $database->quote($splash['domain']),
            "session_agent" => $database->quote($splash['agent']),
            "session_token" => $database->quote($splash['token']),
            "session_expires" => $expiry,
            "session_lastactive" => time(),
            "session_registry" => $database->quote($userdata)
        ));
    }
541147
public function write($sessionId, $data): bool
    {
        $filename = $this->savePath . \DIRECTORY_SEPARATOR . $this->prefix . $sessionId;

        return \file_put_contents($filename, $data) === false ? false : true;
    }
306404
public function write($session_id, $session_data)
    {
        $this->sessions[$session_id] = [
            'time' => $this->createTimestamp(),
            'data' => $session_data
        ];

        return true;
    }
659712
public function write($sessionId, $data)
    {
        $this->cache->save($this->prefix . $sessionId, $data, $this->lifetime);
    }
1070625
public function write($session_id, $session_data)
    {
        // When create the new session record
        if (! $this->sessions()->where('id', $session_id)->exists()) {
            $insert = $this->sessions()
                ->insert($this->data($session_id, $session_data));

            return $insert == 1;
        }

        // Update the session information
        $update = $this->sessions()->where('id', $session_id)->update([
            'data' => $session_data,
            'id' => $session_id
        ]);

        return $update == 1;
    }
1038001
protected function saveBrokerSessionData(string $brokerSessionId, string $sessionData)
    {
        /** This is basic example and you should do something better. */

        $cacheFile = fopen('broker_session_' . $brokerSessionId, 'w');
        fwrite($cacheFile, $sessionData);
        fclose($cacheFile);
    }
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;
	}
268127
public function do_write($session_id, $data, $ttl)
    {
        $redis = is_object($this->_redis) ? $this->_redis : $this->_getRedis();
        return $redis->set($this->_prefix . $session_id, $data, $ttl);
    }
940911
public function write($sessionID, $sessionData, $maxLifeTime)
    {
        Coroutine::writeFile($this->getFileName($sessionID), $sessionData, LOCK_EX);
    }
966893
public function write($session_id, $session_data)
	{
		$this->files->put($this->path . DS . $session_id, $session_data, true);
	}
1023799
public function write($sessID, $sessData)
    {
        return $this->memcachedDriver->set($this->config['prefix'] . $sessID, $sessData, $this->config['expire']);
    }
650597
public function read($splash, $session, $sessionId)
    {

        $ini = new Ini();
        $store = $session->folder . DIRECTORY_SEPARATOR;

        //We need to know the array;
        if (!is_array($splash)) return false;

        $sfile = $store . $sessionId . ".ini";


        if (!$ini->isFile($sfile)) {
            //If we can't file the sessionf file;
            //throw new \Exception("The session file does not exists");
            return false;
        }

        //Temporarily chmode the file;
        $ini->chmod($sfile, 0755);

        if (!$ini->readParams($sfile)) {
            throw new \Exception("Could not read the session configuration file");
            return false;
        }

        $sess = $ini->getParams($sfile);

        if (!is_array($sess) || empty($sess)) {
            throw new \Exception("Invalid session file");
            return false;
        }

        //return data as an object;
        $object = new \stdClass;
        $object->session_id = $sessionId;
        $object->session_key = $sess['key'];
        $object->session_ip = $sess['ip'];
        $object->session_host = $sess['domain'];
        $object->session_agent = $sess['agent'];
        $object->session_token = $sess['token'];
        $object->session_expires = $sess['expiry'];
        $object->session_lastactive = $sess['active'];
        $object->session_registry = $sess['registry'];

        return $object;

    }
798600
public function DeleteUserData($UserID, $Options = array(), &$Data = NULL) {
      $SQL = Gdn::SQL();
      
      // Remove discussion watch records and drafts.
		$SQL->Delete('UserDiscussion', array('UserID' => $UserID));
      
		Gdn::UserModel()->GetDelete('Draft', array('InsertUserID' => $UserID), $Data);
      
      // Comment deletion depends on method selected
      $DeleteMethod = GetValue('DeleteMethod', $Options, 'delete');
      if ($DeleteMethod == 'delete') {
         // Clear out the last posts to the categories.
         $SQL
            ->Update('Category c')
            ->Join('Discussion d', 'd.DiscussionID = c.LastDiscussionID')
            ->Where('d.InsertUserID', $UserID)
            ->Set('c.LastDiscussionID', NULL)
            ->Set('c.LastCommentID', NULL)
            ->Put();
         
         $SQL
            ->Update('Category c')
            ->Join('Comment d', 'd.CommentID = c.LastCommentID')
            ->Where('d.InsertUserID', $UserID)
            ->Set('c.LastDiscussionID', NULL)
            ->Set('c.LastCommentID', NULL)
            ->Put();
         
         // Grab all of the discussions that the user has engaged in.
         $DiscussionIDs = $SQL
            ->Select('DiscussionID')
            ->From('Comment')
            ->Where('InsertUserID', $UserID)
            ->GroupBy('DiscussionID')
            ->Get()->ResultArray();
         $DiscussionIDs = ConsolidateArrayValuesByKey($DiscussionIDs, 'DiscussionID');

         
         Gdn::UserModel()->GetDelete('Comment', array('InsertUserID' => $UserID), $Data);
         
         // Update the comment counts.
         $CommentCounts = $SQL
            ->Select('DiscussionID')
            ->Select('CommentID', 'count', 'CountComments')
            ->Select('CommentID', 'max', 'LastCommentID')
            ->WhereIn('DiscussionID', $DiscussionIDs)
            ->GroupBy('DiscussionID')
            ->Get('Comment')->ResultArray();
         
         foreach ($CommentCounts as $Row) {
            $SQL->Put('Discussion',
               array('CountComments' => $Row['CountComments'] + 1, 'LastCommentID' => $Row['LastCommentID']),
               array('DiscussionID' => $Row['DiscussionID']));
         }
         
         // Update the last user IDs.
         $SQL->Update('Discussion d')
            ->Join('Comment c', 'd.LastCommentID = c.CommentID', 'left')
            ->Set('d.LastCommentUserID', 'c.InsertUserID', FALSE, FALSE)
            ->Set('d.DateLastComment', 'c.DateInserted', FALSE, FALSE)
            ->WhereIn('d.DiscussionID', $DiscussionIDs)
            ->Put();
         
         // Update the last posts.
         $Discussions = $SQL
            ->WhereIn('DiscussionID', $DiscussionIDs)
            ->Where('LastCommentUserID', $UserID)
            ->Get('Discussion');
         
         // Delete the user's dicussions 
         Gdn::UserModel()->GetDelete('Discussion', array('InsertUserID' => $UserID), $Data);
         
         // Update the appropriat recent posts in the categories.
         $CategoryModel = new CategoryModel();
         $Categories = $CategoryModel->GetWhere(array('LastDiscussionID' => NULL))->ResultArray();
         foreach ($Categories as $Category) {
            $CategoryModel->SetRecentPost($Category['CategoryID']);
         }
      } else if ($DeleteMethod == 'wipe') {
         // Erase the user's dicussions
         $SQL->Update('Discussion')
            ->Set('Body', T('The user and all related content has been deleted.'))
            ->Set('Format', 'Deleted')
            ->Where('InsertUserID', $UserID)
            ->Put();

         $SQL->Update('Comment')
            ->Set('Body', T('The user and all related content has been deleted.'))
            ->Set('Format', 'Deleted')
            ->Where('InsertUserID', $UserID)
            ->Put();
      } else {
         // Leave comments
      }

      // Remove the user's profile information related to this application
      $SQL->Update('User')
         ->Set(array(
				'CountDiscussions' => 0,
				'CountUnreadDiscussions' => 0,
				'CountComments' => 0,
				'CountDrafts' => 0,
				'CountBookmarks' => 0
			))
         ->Where('UserID', $UserID)
         ->Put();
   }
148475
function setUserData(userData) {

   let u = getUserData();
   if (u.coreSessionToken && userData.coreSessionToken) {
      // only store the newer one 
      let coreSessionToken = null;
      if (u.coreSessionToken.timestamp < userData.coreSessionToken.timestamp) {
         coreSessionToken = userData.coreSessionToken;
      }
      else {
         coreSessionToken = u.coreSessionToken;
      }
      userData.coreSessionToken = coreSessionToken;
   }
   
   localStorage.setItem(LOCAL_STORAGE_ID, JSON.stringify(userData));
}
757901
public function write($sessionId, $sessionData) {
        // serialize and encode the session data.
        $serializedData = base64_encode(serialize($sessionData));

        try {
            // try to retrive the stored session entity and update it.
            $result = $this->_tableRestProxy->getEntity($this->_sessionContainer, $this->_sessionContainerPartition, $sessionId);
            $entity = $result->getEntity();

            // update data and expiry time
            $entity->setPropertyValue('data', $serializedData);
            $entity->setPropertyValue('expires', time());

            // update entity
            $this->_tableRestProxy->updateEntity($this->_sessionContainer, $entity);
        } catch (ServiceException $e) {
            // otherwise, create a new session entity to store the data.
            $entity = new Entity();

            // set partition key and use session id as the row key.
            $entity->setPartitionKey($this->_sessionContainerPartition);
            $entity->setRowKey($sessionId);
            // set data and expiry time
            $entity->addProperty('data', EdmType::STRING, $serializedData);
            $entity->addProperty('expires', EdmType::INT32, time());

            // insert the entity
            $this->_tableRestProxy->insertEntity($this->_sessionContainer, $entity);
        }
        return TRUE;
    }
42876
public function write($id, $data) {
    // TODO: Implement locking. b/7701850
    return $this->memcacheContainer->set(
        self::SESSION_PREFIX . $id, $data, $this->expire);
  }
269102
public function write($sessID, $sessData)
    {
        $hander = is_array($this->hander) ? $this->hander[0] : $this->hander;
        $expire = time() + $this->lifeTime;
        mysqli_query($hander, "REPLACE INTO  " . $this->sessionTable . " (  session_id, session_expire, session_data)  VALUES( '$sessID', '$expire',  '$sessData')");
        if (mysqli_affected_rows($hander))
            return true;
        return false;
    }