Save a given session to storage.

@param array $session
@param array $config
@param bool  $exists
480511
public function save($session, $config, $exists)
    {
        $this->dba->put($session['id'], $session, $config['lifetime']);
    }
877340
private function setConfig(array $config)
    {
        // Cookie name
        if (isset($config['cookieName'])) {
            if (!ctype_alnum($config['cookieName'])) {
                throw new \Exception('Invalid cookie name provided.');
            }

            $this->cookieName = $config['cookieName'];
        }

        // Database table name
        if (isset($config['tableName'])) {
            $this->tableName = $config['tableName'];
        }

        // Expiration time in seconds
        if (isset($config['secondsUntilExpiration'])) {
            // Anything else than digits?
            if (!is_int($config['secondsUntilExpiration']) || $config['secondsUntilExpiration'] <= 0) {
                throw new \Exception('Seconds until expiration must be a positive non-zero integer.');
            }

            $this->secondsUntilExpiration = (int) $config['secondsUntilExpiration'];
        }

        // How often should the session be renewed?
        if (isset($config['renewalTime'])) {
            // Anything else than digits?
            if (!is_int($config['renewalTime']) || $config['renewalTime'] <= 0) {
                throw new \Exception('Session renewal time must be a valid non-zero integer.');
            }

            $this->renewalTime = (int) $config['renewalTime'];
        }

        // End the session when the browser is closed?
        if (isset($config['expireOnClose'])) {
            // Not true or false?
            if (!is_bool($config['expireOnClose'])) {
                throw new \Exception('Expire on close must be either true or false.');
            }

            $this->expireOnClose = $config['expireOnClose'];
        }

        // Check IP addresses?
        if (isset($config['checkIpAddress']) && $config['checkIpAddress'] === true) {
            $this->checkIpAddress = true;
            $this->ipAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
        }

        // Check user agent?
        // Hashing HTTP_USER_AGENT only so it stores in a fixed size field
        if (isset($config['checkUserAgent']) && $config['checkUserAgent'] === true) {
            $this->checkUserAgent = true;
            $this->userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? substr($_SERVER['HTTP_USER_AGENT'], 0, 64) : 'unknown';
        }

        // Send cookie only when HTTPS is enabled?
        if (isset($config['secureCookie'])) {
            if (!is_bool($config['secureCookie'])) {
                throw new \Exception('The secure cookie option must be either true or false.');
            }

            $this->secureCookie = $config['secureCookie'];
        }

        // Salt key
        if (isset($config['salt'])) {
            $this->salt = $config['salt'];
        } else {
            throw new \Exception('Session salt encryption key not set');
        }

        // Auto-Run
        if (isset($config['autoRunSession'])) {
            $this->autoRunSession = $config['autoRunSession'];
        }
    }
251569
protected function _saveSessionCookie($sName, $sValue, $iExpire, $sPath, $sDomain)
    {
        if ($this->_mustSaveToSession()) {
            $aCookieData = ['value' => $sValue, 'expire' => $iExpire, 'path' => $sPath, 'domain' => $sDomain];

            $aSessionCookies = ( array ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable($this->_sSessionCookiesName);
            $aSessionCookies[$this->_getSessionCookieKey(false)][$sName] = $aCookieData;

            \OxidEsales\Eshop\Core\Registry::getSession()->setVariable($this->_sSessionCookiesName, $aSessionCookies);
        }
    }
634382
public function save(array $params = [])
    {

        $index      = array_get($params, 'index');
        $visibility = array_get($params, 'visible');
        $key        = array_get($params, 'key');

        if (is_null($index) or is_null($visibility) or is_null($key)) {
            return false;
        }
        $request = request();
        $session = $request->session();

        if ($session->has($key)) {
            $data         = $session->get($key);
            $data[$index] = $visibility === "true";
            $session->remove($key);
        } else {
            $data = [$index => $visibility === "true"];
        }
        $session->put($key, $data);
        $session->save();
        return $data;
    }
118698
public function save(): void
        {
            if ($this->active() && session_name() == $this->name()) {
                $_SESSION = $this->all();
                session_write_close();
            }
        }
1275860
function createSession(config, cb) {
  checkOpts(config, cb)

  cb = utils.callOnce(cb)

  var url = config.url
  var key = config.key

  config = {
    url: url,
    key: key
  }

  session.createSession(config, cb)
}
1136995
static function setConfig($config, $instance = 'default')
    {
        self::$config[$instance]['dsn'] = array_key_exists('dsn', $config) ? $config['dsn'] : "";
        self::$config[$instance]['username'] = array_key_exists('username', $config) ? $config['username'] : null;
        self::$config[$instance]['password'] = array_key_exists('password', $config) ? $config['password'] : null;
        self::$config[$instance]['options'] = array_key_exists('options', $config) ? $config['options'] : array();
    }
1312482
public function registerSessionHandler(array $config = [])
    {
        $handler = SessionHandler::fromClient($this, $config);
        $handler->register();

        return $handler;
    }
1123558
public function save($session, $config, $exists)
    {
        $this->redis->put($session['id'], $session, $config['lifetime']);
    }
255229
protected function setTimestampsOnAttach(array $record, $exists = false)
	{
		$fresh = $this->parent->freshTimestamp();

		if ( ! $exists) $record[$this->createdAt()] = $fresh;

		$record[$this->updatedAt()] = $fresh;

		return $record;
	}
361849
public static function exists($name)
	{
		if(isset(self::$modifys[$name]))
		{
			return true;
		}
		else if(array_key_exists($name,self::$modifys))
		{
			return false;
		}
		else
		{
			self::init();
			self::save();
			$names = parseCfgName($name);
			$var = $_SESSION;
			foreach($names as $name)
			{
				if('@' === $name)
				{
					$name = self::$prefix;
				}
				if('' !== $name)
				{
					$var = $var[$name];
				}
			}
			return isset($var);
		}
	}
360795
public function save()
    {
        $this->session['last_activity'] = time();

        // age it that should expire at the end of the user's next request.
        $this->age();

        $sessionConf = Config::get('session');

        // save data into the specialized storage.
        $this->storage->save($this->session, $sessionConf, $this->exists);

        // determine the owner of the session
        // on the user's subsequent requests to the application.
        $this->cookie($sessionConf);

        // calculate and run garbage collection cleaning.
        $cleaning = $sessionConf['garbage_collection'];

        if (mt_rand(1, $cleaning[1]) <= $cleaning[0]) {
            $this->clean();
        }
    }
1149075
private function doPersist(Config $config, array $config_to_persist)
    {
        foreach ($this->persistors as $persistor) {
            if (true === $persistor->persist($config, $config_to_persist)) {
                $this->application->getContainer()->get('container.builder')->removeContainerDump();
                break;
            }
        }
    }
434524
protected function checkConfig(array $config): void
    {
        foreach (['host', 'username', 'password', 'database', 'persistent'] as $key) {
            if (!isset($config[$key])) {
                $class = get_class($this);
                throw new ConfigException("Missing configuration key={$key} in {$class}");
            }
        }
    }
54956
public function save()
    {
        $json = [];
        foreach ($this as $cookie) {
            /** @var SetCookie $cookie */
            if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
                $json[] = $cookie->toArray();
            }
        }

        $_SESSION[$this->sessionKey] = json_encode($json);
    }
711692
public function saveSession($qouoteId, $checkoutSession)
    {
        // cache the session id by (parent) quote id
        $cacheIdentifier = self::BOLT_SESSION_PREFIX . $qouoteId;
        $sessionData = [
            "sessionType" => $checkoutSession instanceof \Magento\Checkout\Model\Session ? "frontend" : "admin",
            "sessionID"   => $checkoutSession->getSessionId()
        ];
        $this->cache->save(serialize($sessionData), $cacheIdentifier, [], 86400);
    }
28688
public function setSession(array $session = array())
    {
        $this->session = $session;
        if ($this->storeSession)
        {
            $this->storeSession($session);
        }
        return $this;
    }