protected function sessionTimedOut(ServletSessionInterface $session)
    {

        // we want to know what inactivity timeout we've to check the sessions for
        $inactivityTimeout = $this->getSessionSettings()->getInactivityTimeout();

        // load the sessions last activity timestamp
        $lastActivitySecondsAgo = time() - $session->getLastActivityTimestamp();

        // query whether or not an inactivity timeout has been set
        if ($inactivityTimeout < 1) {
            // if NOT, the inactivity timeout has to be higher than
            // the last activity timestamp to avoid session timeout
            $inactivityTimeout = $lastActivitySecondsAgo + 1;
        }

        // return TRUE it the last ativity timeout OR the session lifetime has been reached
        return $lastActivitySecondsAgo > $inactivityTimeout || $session->getLifetime() < time();
    }