Ability to reload change in Magento site's configuration without clearing cache

Ability to reload change in Magento site's configuration without clearing cache

July 30, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Ability to reload change in Magento site's configuration without clearing cache

Reloading Magento Configuration Changes Without Clearing Cache

As a Magento developer dealing with live sites under heavy load, we often face situations where we need to update configuration files without disrupting the user experience or performance. In your case, you’re looking for a way to deploy changes in module configuration without completely clearing the cache.

Understanding Magento’s Configuration System

Magento uses XML configuration files (located in app/code/) which are cached and merged into a single file (app/etc/config.xml). When you clear the cache, this process is re-run, leading to downtime. However, Magento provides a way to update configurations dynamically without a full cache rebuild.

Updating Configuration Dynamically

Magento allows you to use the Mage::getConfig()->reinit() method to reload the configuration once it has been updated. Here’s how you can do this:

  1. Update your configuration file

    Suppose you have made changes in your module’s config.xml file under app/code/local/Your/Module/etc/.

  2. Reload the configuration

    After updating, use Mage::getConfig()->reinit() to reload the configuration.

Here’s an example of how this can be done:

// Before making changes
$new_config = '<?xml version="1.0"?>
            <config>
                <your_module>
                    <active>1</active>
                </your_module>
            </config>';

file_put_contents('app/code/local/Your/Module/etc/config.xml', $new_config);

// After changes are made, reload the configuration
Mage::getConfig()->reinit();

// Now, the changes are reflected in the site without clearing cache

Practical Implementation

You can create a custom module that handles these updates. Create an etc directory under your module and add config.xml. Then, you can use controllers or cron jobs to update this file dynamically when needed.

Here’s a simple example of a controller action:

public function reloadConfigAction()
{
    $new_config = '...'; // Your updated config here.
    file_put_contents('app/code/local/Your/Module/etc/config.xml', $new_config);
    Mage::getConfig()->reinit();

    echo "Configuration reloaded successfully.";
}

Remember to clear the specific config.xml cache at var/cache/mage--->cache_config.xml manually once after updating.

Conclusion

Reloading Magento configuration changes without clearing the entire cache is possible using Mage::getConfig()->reinit(). This method allows you to update configurations on-the-fly, reducing downtime and maintaining site performance.

However, while this technique works, it’s important to use it judiciously. Frequent reinitialization of the configuration can still have a minor impact on performance. It’s best used for critical updates that require immediate deployment.

For more advanced caching strategies in Magento and tips on optimizing your e-commerce site, I recommend checking out our comprehensive guides at LaravelCompany.

Cache Performance Extensions Configuration

Our network