Thursday, October 6, 2011

Clear Cache from Action in Symfony

/**
 * Delete cache for application and environment
 *
 * @param string $app aplicaciĆ³n
 * @param string $env entorno
 */
function clear_cache ($app, $env)
{
  $cacheDir = sfConfig::get('sf_cache_dir').'/'. $app.'/'.$env.'/';

  //Clear cache
  $cache = new sfFileCache(array('cache_dir' => $cacheDir));
  $cache->clean();
}

No comments:

Post a Comment