コード例 #1
0
ファイル: AppTest.php プロジェクト: nemphys/magento2
 public function testCleanCache()
 {
     $this->assertEmpty($this->_mageModel->loadCache('test_id'));
     $this->_mageModel->saveCache('test_data', 'test_id', array('test_tag'));
     $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id'));
     $this->_mageModel->cleanCache(array('test_tag'));
     $this->assertEmpty($this->_mageModel->loadCache('test_id'));
 }
コード例 #2
0
ファイル: Config.php プロジェクト: nemphys/magento2
 /**
  * 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));
         }
     }
 }
コード例 #3
0
ファイル: Data.php プロジェクト: monkviper/magento-lite
 /**
  * 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;
 }