The scenario is like this. I want to programmatically change config data and write those values to cache. I know changing config data through programmatically is possible and how to do. But how can I write those changed config values to cache?

Any suggestions will be appreciated.

Thanks in advance.


If you have the cache for config enabled those values will be automatically cached.
Just make sure you clear the config cache after you modify your values:

  • :Thanks for the quick response.You mean if I programmatically change the config values and refresh the config cache will only be enough? Means that I don't want to write changed config data to cache right? Can this be done dynamically via a function call? – Sukeshini Feb 11 '14 at 8:03
  • @Sukeshini You don't need to write the values to the cache. I don't even think it's possible to write INSIDE the config cache. If you clear the cache when you modify the value it will be cached next time the config is loaded with the new value. – Marius Feb 11 '14 at 8:09
  • 1
    @Sukeshini if i am understand properly you dont have to change config value but you have to change for particular condition then you can use this Mage::getConfig()->setNode($path, $value); reference:stackoverflow.com/questions/14871738/… – Keyur Shah Feb 11 '14 at 8:22
  • @Marius Thank you very much for the clarification and +1 – Sukeshini Feb 11 '14 at 8:33
  • @Keyur Shah Thank you for the suggestion and +1 – Sukeshini Feb 11 '14 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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