本文整理汇总了PHP中Mage_Core_Model_Config::getLockingOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config::getLockingOptions方法的具体用法?PHP Mage_Core_Model_Config::getLockingOptions怎么用?PHP Mage_Core_Model_Config::getLockingOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Config
的用法示例。
在下文中一共展示了Mage_Core_Model_Config::getLockingOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initModulesSafe
/**
* Version of _initModules that locks the requests using redis and
* effectively blocks every parallell request that would otherwise
* regenerate the cache.
*
* @see Made_Cache_Model_Config
* @return $this
*/
protected function _initModulesSafe()
{
if ($this->_config->loadModulesCache()) {
return $this;
}
$backend = Mage::app()->getCacheInstance()->getFrontend()->getBackend();
$options = $this->_config->getLockingOptions();
// Spin lock
$lockSpun = false;
while (!$backend->acquireLock($options['lock_name'], $options['token'], $options['lock_timeout'], $lockSpun)) {
$lockSpun = true;
usleep($options['spin_timeout']);
}
if ($lockSpun) {
// The cache might have been generated while we waited for the lock
if ($this->_config->loadModulesCache()) {
$backend->releaseLock($options['lock_name'], $options['token']);
return $this;
}
}
$this->_config->loadModules();
if ($this->_config->isLocalConfigLoaded() && !$this->_shouldSkipProcessModulesUpdates()) {
Varien_Profiler::start('mage::app::init::apply_db_schema_updates');
Mage_Core_Model_Resource_Setup::applyAllUpdates();
Varien_Profiler::stop('mage::app::init::apply_db_schema_updates');
}
$this->_config->loadDb();
$this->_config->saveCache();
$backend->releaseLock($options['lock_name'], $options['token']);
return $this;
}