Search code examples
phpcachingsymfony1

Clearing Symfony cache for another application


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

How can I achieve this?


Solution

  • I believe the proper 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