AppserverIo\Appserver\ServletEngine\StandardSessionManager::flush PHP Method

flush() public method

Flushes the session storage and persists all sessions.
public flush ( ) : void
return void
    public function flush()
    {
        // persist all sessions
        /** @var \AppserverIo\Psr\Servlet\ServletSessionInterface $session */
        foreach ($this->getSessions() as $session) {
            // iterate over the session handlers and persist the sessions
            /** @var \AppserverIo\Appserver\ServletEngine\Session\SessionHandlerInterface $sessionHandler */
            foreach ($this->getSessionHandlers() as $sessionHandler) {
                try {
                    $sessionHandler->save($session);
                } catch (\Exception $e) {
                    // log the exception if a system logger is available
                    if ($logger = $this->getLogger(LoggerUtils::SYSTEM)) {
                        $logger->error($e->__toString());
                    }
                }
            }
        }
    }