本文整理汇总了PHP中Mage_Core_Model_App::loadCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::loadCache方法的具体用法?PHP Mage_Core_Model_App::loadCache怎么用?PHP Mage_Core_Model_App::loadCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::loadCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCleanCache
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: __construct
/**
* 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: getRegionJsonByStore
/**
* 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;
}