Backend\Modules\Pages\Engine\CacheBuilder::buildCache PHP Метод

buildCache() публичный Метод

Builds the pages cache
public buildCache ( string $language )
$language string The language to build the cache for.
    public function buildCache($language)
    {
        // kill existing caches so they can be re-generated
        $this->cache->deleteItems(array('keys_' . $language, 'navigation_' . $language));
        $keys = $this->getKeys($language);
        $navigation = $this->getNavigation($language);
        // build file with navigation structure to feed into editor
        $filesystem = new Filesystem();
        $cachePath = FRONTEND_CACHE_PATH . '/Navigation/';
        $filesystem->dumpFile($cachePath . 'editor_link_list_' . $language . '.js', $this->dumpEditorLinkList($navigation, $keys, $language));
    }

Usage Example

Пример #1
0
 /**
  * Build the cache
  *
  * @param string $language The language to build the cache for, if not passes we use the working language.
  */
 public static function buildCache($language = null)
 {
     // redefine
     $language = $language === null ? BL::getWorkingLanguage() : (string) $language;
     $cacheBuilder = new CacheBuilder(BackendModel::get('database'));
     $cacheBuilder->buildCache($language);
     // trigger an event
     BackendModel::triggerEvent('Pages', 'after_recreated_cache');
 }