Clear symfony cache for another application

I would like to clear the cache of my front end from the action in my backend application.

How can i achieve this?

+5
source share
5 answers

I believe that the correct way to do this in symfony 1.2 is as follows:

sfContext::switchTo('frontend'); //switch to the environment you wish to clear
sfContext::getInstance()->getViewCacheManager()->getCache()->clean(sfCache::ALL);
sfContext::switchTo('backend'); //switch back to the environment you started from
+8
source

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

$cache_dir = sfConfig::get('sf_cache_dir').'/'.$app.'/'.$env.'/';

$cache = new sfFileCache(array('cache_dir' => $cache_dir));
$cache->clean();
+4
source

- ( ):

sfContext::switchTo('frontend');
sfContext::getInstance()->getViewCacheManager()->remove("module/action?&param1=value1&param2=value2","THE-DOMAIN-OF-YOUR-FRONTEND-APPLICATION-IF-U-USE-IT-IN-CACHE-KEYS");
sfContext::switchTo('backend');
+1

, "" , symfony. , , /dir, phing clear-cache (cc) ..

rm -rf cache/*, . - Symfony cc passthru() exec()

0

sfTask ( 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);

. sfTask...

0

All Articles