/** * Saves the modules settings to the cache * * @return bool */ protected function saveCache() { $settings = $this->systemSettingsRepository->getAllSettings(); $data = []; foreach ($settings as $setting) { $data[$setting['module_name']][$setting['name']] = $setting['value']; } return $this->coreCache->save(static::CACHE_ID, $data); }
/** * Saves the modules info cache */ public function saveModulesInfoCache() { $infos = []; // 1. fetch all core modules // 2. Fetch all 3rd party modules // 3. Fetch all local module customizations foreach ($this->vendors->getVendors() as $vendor) { $infos += $this->fetchVendorModules($vendor); } $this->cache->save($this->getCacheKey(), $infos); }
/** * Sets the cache for all registered languages * * @return bool */ protected function saveLanguagePacksCache() { $languagePacks = []; foreach ($this->vendors->getVendors() as $vendors) { $languageFiles = glob($this->appPath->getModulesDir() . $vendors . '/*/Resources/i18n/*.xml'); if ($languageFiles !== false) { foreach ($languageFiles as $file) { $languagePack = $this->registerLanguagePack($file); if (!empty($languagePack)) { $languagePacks += $languagePack; } } } } return $this->cache->save('language_packs', $languagePacks); }
/** * @inheritdoc */ public function getURI($layout = 'layout') { $debug = $this->environment === 'dev'; $filenameHash = $this->generateFilenameHash($this->assetGroup, $layout); $cacheId = 'assets-last-generated-' . $filenameHash; if (false === ($lastGenerated = $this->systemCache->fetch($cacheId))) { $lastGenerated = time(); // Assets are not cached -> set the current time as the new timestamp } $path = $this->buildAssetPath($debug, $this->assetGroup, $filenameHash, $lastGenerated); // If the requested minified StyleSheet and/or the JavaScript file doesn't exist, generate it if (is_file($this->appPath->getUploadsDir() . $path) === false || $debug === true) { // Get the enabled libraries and filter out empty entries $files = array_filter($this->processLibraries($layout), function ($var) { return !empty($var); }); $this->saveMinifiedAsset($files, $this->appPath->getUploadsDir() . $path); // Save the time of the generation if the requested file $this->systemCache->save($cacheId, $lastGenerated); } return $this->appPath->getWebRoot() . 'uploads/' . $path . ($debug === true ? '?v=' . $lastGenerated : ''); }
/** * @param array $paths * * @return bool */ public function saveCache(array $paths) { return $this->cache->save(self::CACHE_ID, $paths); }