Example of using $sessionData available in updateTimestamp function.
This is useful when we try to use cookie as a container to save session data.
In cookie we need to maintain the access timestamp on similar lines of access time of file.
Here we have session.serialize_handler as php_serialize to use serialize() and unserialize() for session encoded data.
<?php
    public function updateTimestamp($sessionId, $sessionData)
    {
        $sessionDataArr = unserialize($sessionData);
        $sessionDataArr['_TS_'] = $this->currentTimestamp;
        $sessionData = serialize($sessionDataArr);
        $cookieData = $this->encryptData($sessionData);
        if (strlen($cookieData) > 4096) {
            ob_end_clean();
            die('Session data length exceeds max 4 kilobytes (KB) supported per Cookie');
        }
        return setcookie(
            $name = $this->sessionDataName,
            $value = $cookieData,
            $options = [
                'expires' => 0,
                'path' => '/',
                'domain' => '',
                'secure' => ((strpos($_SERVER['HTTP_HOST'], 'localhost') === false) ? true : false),
                'httponly' => true,
                'samesite' => 'Lax'
            ]
        );
    }
?>