In #1929136: Fix override-free context, move global config overrides back to an event listener we moved the override data to the config context opening the possible of not rereading configuration data from the database when switching context.

Comments

Component:simpletest.module» configuration system

On the other issue I proposed to always keep Config objects unchanged, and decorate them using the context instead (totally removing the override possibilty over the config object): this would solve this problem naturally: only context would carry overrides, and leaving context would drop those from memory too. It seems also cleaner because Config instances then represent the real stored configuration as it lives into files/datatabase.

This can be done multiple ways, there is one easy one but I'm not sure it's the best one:
* Create a ConfigInterface for config object, with setters and getters
* Implement this interface on both ContextInterface and Config class
* Add the Config object reference in the context instead of the other way (reverse the relationship) (question: is that bad?)
* Make it transparent for the user that when he calls config() he really fetches a context instead of a Config object, but use it as a Config object for get and set etc...

Issue tags:+Performance

Tagging for performance.