public function getDynamicCacheEffectiveMaxAge()
    {
        if (($nb_site = $this->getSite()) === null) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        $retval = false;

        if (($nb_application = CNabuEngine::getEngine()->getApplication()) !== null) {
            if (($nb_running_site = $nb_application->getRequest()->getSite()) instanceof CNabuSite &&
                ($nb_running_site->getId() === $nb_site->getId())
            ) {
                if (($nb_security_manager = $nb_application->getSecurityManager()) !== null &&
                    (!$nb_security_manager->isUserLogged() || $nb_security_manager->arePoliciesAccepted())) {
                    $site_cache_control = $nb_site->getDynamicCacheControl();
                    $site_max_age = $nb_site->getDynamicCacheDefaultMaxAge();
                    $target_cache_control = $this->getDynamicCacheControl();
                    $target_max_age = $this->getDynamicCacheMaxAge();

                    if ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_INHERITED &&
                        $site_cache_control === CNabuSite::DYNAMIC_CACHE_CONTROL_ENABLED &&
                        is_numeric($site_max_age) &&
                        $site_max_age > 0
                    ) {
                        $retval = $site_max_age;
                    } elseif ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_ENABLED &&
                              is_numeric($target_max_age) &&
                              $target_max_age > 0
                    ) {
                        $retval = $target_max_age;
                    }
                }
            } else {
                throw new ENabuCoreException(ENabuCoreException::ERROR_SITES_DOES_NOT_MATCH);
            }
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_APPLICATION_REQUIRED);
        }

        return $retval;
    }