30.12.09 - Symfony, clear cache from an action

Simply PHP function to remove the cache from an action

For application and environment clear cache:
/**
 * 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();
}
More news about:  symfony
Tags:  cache,  clear cache,  action

Comments

There are no comments jet. Be the first to comment!

Comment