public function write($key, $val)
    {
        $key = strval($key);

        if(strlen($key) == 0)
        {
            $msg = 'The key cannot be empty.';
            throw new InvalidArgumentException($msg);
        }

        $this->openSession();
        $_SESSION[$key] = $val;
        $this->closeSession();
    }