Symfony 1.4:创建到另一个应用程序的链接工作非常慢

时间:2013-06-07 06:12:36

标签: php optimization symfony-1.4

我使用的实施 - http://symfony.com/blog/cross-application-links

// apps/backend/config/backendConfiguration.class.php
class backendConfiguration extends sfApplicationConfiguration
{
    protected $frontendRouting = null;

    public function generateFrontendUrl($name, $parameters = array())
    {
        return 'http://frontend.example.com'.$this->getFrontendRouting()->generate($name, $parameters);
    }

    public function getFrontendRouting()
    {
        if (!$this->frontendRouting)
        {
            $this->frontendRouting = new sfPatternRouting(new sfEventDispatcher());

            $config = new sfRoutingConfigHandler();
            $routes = $config->evaluate(array(sfConfig::get('sf_apps_dir').'/frontend/config/routing.yml'));

            $this->frontendRouting->setRoutes($routes);
        }

        return $this->frontendRouting;
    }
}

一切正常,但首先调用generateFrontendUrl函数执行大约1-2秒。

如何解决这个问题?

0 个答案:

没有答案