src/Web/Sessions/CachedSessionHandler.php
public function write($id, $data)
    {
        $key = $this->getSessionKey($id);
        $record = $this->packRecord($data);
        return $this->writeDataToCache($key, $record)->then(
            function() use ($id) {
                $this->keys[$id] = time();
                return $this->read($id);
            },
            function($error = null) use ($id) {
                $message = sprintf('Failed to write session data for "%s"', $id);
                throw new SessionException($message, 0, $error);
            }
        );
    }
public function write($id, $data)
    {
        $key = $this->getSessionKey($id);
        $record = $this->packRecord($data);
        return $this->writeDataToCache($key, $record)->then(
            function() use ($id) {
                $this->keys[$id] = time();
                return $this->read($id);
            },
            function($error = null) use ($id) {
                $message = sprintf('Failed to write session data for "%s"', $id);
                throw new SessionException($message, 0, $error);
            }
        );
    }
Write session data to storage
@param string $id
@param array  $data
@return ExtendedPromiseInterface  with session data