I'm trying to find out the way to get store configuration values (Mage::getStoreConfig($path, $store)) from cache. The reason for this is that I don't want to make db connections every time I'm calling the configuration values. Is there a way to use cache for the said purpose?


2 Answers 2


Calling Mage::getStoreConfig automatically uses Magento cache.

It uses the getConfig method from Mage_Core_Model_Store which as you can see return the value from the cache if set:

public function getConfig($path)
    if (isset($this->_configCache[$path])) {
        return $this->_configCache[$path];

    $config = Mage::getConfig();

    $fullPath = 'stores/' . $this->getCode() . '/' . $path;
    $data = $config->getNode($fullPath);
    if (!$data && !Mage::isInstalled()) {
        $data = $config->getNode('default/' . $path);
    if (!$data) {
        return null;
    return $this->_processConfigValue($fullPath, $path, $data);

The $_configCache is initiated via the initConfigCache method from Mage_Core_Model_App which is itself called during the _initStores method. If we continue, the _initStores method is called during the _initCurrentStore, itself called when Mage::run is called.


Mage::getStoreConfig($path,$store) is already stored in cache if you look in this file app\code\core\Mage\Core\Model\App.php

protected function _initModules()
    if (!$this->_config->loadModulesCache()) {
        if ($this->_config->isLocalConfigLoaded() && !$this->_shouldSkipProcessModulesUpdates()) {
    return $this;

To verify if values coming from cache, change value direct from db table core_config_data you will see the result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.