Clearing Symfony cache for another application

后端 未结 5 2251
不知归路
不知归路 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:16

    This works for me. It removes all cached files from the given directory:

    $cache_dir = sfConfig::get('sf_cache_dir').'/'.$app.'/'.$env.'/';
    
    $cache = new sfFileCache(array('cache_dir' => $cache_dir));
    $cache->clean();
    

提交回复
热议问题