public static function clearCache($rt_shop_category = null) { $cache = sfContext::getInstance()->getViewCacheManager(); if ($cache) { rtGlobalCacheToolkit::clearCache(); $cache->remove('rtShopCategory/index'); $file_cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'frontend')); $file_cache->removePattern('**/rtShopCategory/_navigation/*'); $cache->remove('@sf_cache_partial?module=rtShopCategory&action=_navigation&sf_cache_key=*'); $cache->remove('@sf_cache_partial?module=rtShopCategory&action=_navigation&sf_cache_key=40cd750bba9870f18aada2478b24840a'); $cache->remove('rtShopCategory/_navigation?module=rtShopCategory&action=*&sf_cache_key=*'); // '/1_mysite_com/all/rtShopCategory/index/page/1'; if (!is_null($rt_shop_category)) { if ($rt_shop_category->getNode()->isRoot()) { $cache->remove('rtShopCategory/index?page=*'); } $cache->remove(sprintf('rtShopCategory/show?id=%s&slug=%s', $rt_shop_category->getId(), $rt_shop_category->getSlug())); // show page $cache->remove(sprintf('rtShopCategory/show?id=%s&slug=%s&page=*', $rt_shop_category->getId(), $rt_shop_category->getSlug())); // show page $cache->remove(sprintf('rtShopCategory/show?id=%s&slug=%s&page=*&show_more=', $rt_shop_category->getId(), $rt_shop_category->getSlug())); // show page $cache->remove('@sf_cache_partial?module=rtShopCategory&action=_shop_category&sf_cache_key=' . $rt_shop_category->getId()); // show page partial. } } }
/** * Remove cache (with cached i18n app dicts) * * @param array $params Object params * @return void */ public function removeCache(array $params) { if ($params['dictionary_id']) { if ($dict = Doctrine::getTable('DinLanguageDictionary')->find($params['dictionary_id'])) { $driver = new sfFileCache(array('lifetime' => 157680000, 'cache_dir' => sfConfig::get('sf_cache_dir') . '/' . $dict->getApplication() . '/*/i18n/' . $dict->getName())); $driver->removePattern('*'); } } parent::removeCache($params); }
public static function clearCache($rt_site_page = null) { $cache = sfContext::getInstance()->getViewCacheManager(); if ($cache) { rtGlobalCacheToolkit::clearCache(); $cache->remove('rtSitePage/index'); $file_cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'frontend')); $file_cache->removePattern('**/rtSitePage/_navigation/*'); $cache->remove('@sf_cache_partial?module=rtSitePage&action=_navigation&sf_cache_key=*'); $cache->remove('@sf_cache_partial?module=rtSitePage&action=_navigation&sf_cache_key=40cd750bba9870f18aada2478b24840a'); $cache->remove('rtSitePage/_navigation?module=rtSitePage&action=*&sf_cache_key=*'); if (!is_null($rt_site_page)) { $cache->remove(sprintf('rtSitePage/show?slug=%s', $rt_site_page->getSlug())); // show page $cache->remove(sprintf('rtSitePage/show?id=%s&slug=%s', $rt_site_page->getId(), $rt_site_page->getSlug())); // show page $cache->remove('@sf_cache_partial?module=rtSitePage&action=_site_page&sf_cache_key=' . $rt_site_page->getId()); // show page partial. } } }
/** * Remove cache (with cached i18n app dicts) * * @param array $params Object params * @return void */ public function removeCache(array $params) { if ($params['application'] && $params['name']) { $driver = new sfFileCache(array('lifetime' => 157680000, 'cache_dir' => sfConfig::get('sf_cache_dir') . '/' . $params['application'] . '/*/i18n/' . $params['name'])); $driver->removePattern('*'); } }
/** * @see sfCache */ public function removePattern($pattern) { if (!$pattern instanceof sfRoute) { return parent::removePattern($pattern); } $paths = $this->getGlobPatterns($pattern); foreach ($paths as $path) { $files = glob($path, GLOB_BRACE); foreach ($files as $file) { @unlink($file); } } }