Clearing Symfony cache for another application

后端 未结 5 2248
不知归路
不知归路 2021-02-10 05:37

I would like to clear my frontend application\'s cache from an action in my backend application.

How can I achieve this?

5条回答
  •  北海茫月
    2021-02-10 06:26

    You can create instance of sfTask and run it like this (in sf 1.2):

        $task = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
    
        $arguments = array();
    
        // type can be one of: i18n, routing, template, module, config
        $options = array(
            'frontend'  => 'app',
            'routing'   => 'type', 
            'prod'      => 'env',
        );
    
        $task->run($arguments, $options);
    

    For all possible arguments and options see source code of appropriate sfTask...

提交回复
热议问题