/** * @return Configuration */ public function build() { $servicesFormat = 'xml'; $cachedContainer = $this->_baseDir . '/' . self::CACHED_CONTAINER; $configuration = Configuration::fromParameters($cachedContainer, $this->_collectConfigFolders(), !$this->_mageApp->useCache(self::MODEL_ALIAS), $servicesFormat); $configuration->setTestEnvironment($this->_isTestEnvironment()); return $configuration; }
/** * Crawl all system urls * * @return Enterprise_PageCache_Model_Crawler */ public function crawl() { if (!$this->_app->useCache('full_page')) { return $this; } $adapter = $this->_adapterFactory->getHttpCurlAdapter(); foreach ($this->getStoresInfo() as $storeInfo) { if (!$this->_isCrawlerEnabled($storeInfo['store_id'])) { continue; } $this->_executeRequests($storeInfo, $adapter); } return $this; }
/** * Load config from merged adminhtml.xml files * @param array $arguments */ public function __construct(array $arguments = array()) { $this->_app = isset($arguments['app']) ? $arguments['app'] : Mage::app(); $this->_appConfig = isset($arguments['appConfig']) ? $arguments['appConfig'] : Mage::getConfig(); if (isset($arguments['helpers'])) { $this->_helpers = $arguments['helpers']; } parent::__construct(); $this->setCacheId('adminhtml_acl_menu_config'); /* @var $adminhtmlConfig Varien_Simplexml_Config */ $adminhtmlConfig = $this->_app->loadCache($this->getCacheId()); if ($adminhtmlConfig) { $this->_adminhtmlConfig = new Varien_Simplexml_Config($adminhtmlConfig); } else { $adminhtmlConfig = new Varien_Simplexml_Config(); $adminhtmlConfig->loadString('<?xml version="1.0"?><config></config>'); $this->_appConfig->loadModulesConfiguration('adminhtml.xml', $adminhtmlConfig); $this->_adminhtmlConfig = $adminhtmlConfig; if ($this->_app->useCache('config')) { $this->_app->saveCache($adminhtmlConfig->getXmlString(), $this->getCacheId(), array(Mage_Core_Model_Config::CACHE_TAG)); } } }
public function testUseCache() { $this->assertTrue($this->_mageModel->useCache('config')); $this->assertFalse($this->_mageModel->useCache('not_existing_type')); }
/** * Retrieve regions data json * * @param int|null $storeId * @return array() */ public function getRegionJsonByStore($storeId = null) { Varien_Profiler::start('TEST: ' . __METHOD__); if (!$this->_regionJson) { $store = $this->_app->getStore($storeId); $cacheKey = 'DIRECTORY_REGIONS_JSON_STORE' . (string) $store->getId(); if ($this->_app->useCache('config')) { $json = $this->_app->loadCache($cacheKey); } if (empty($json)) { $regions = $this->_getRegions($storeId); $helper = $this->_factory->getHelper('core'); $json = $helper->jsonEncode($regions); if ($this->_app->useCache('config')) { $this->_app->saveCache($json, $cacheKey, array('config')); } } $this->_regionJson = $json; } Varien_Profiler::stop('TEST: ' . __METHOD__); return $this->_regionJson; }