Just to add some more details.
In most of the projects I use roots/bedrock architecture – https://github.com/roots/bedrock
If You add the WP_CACHE at the very top of the file I am unable to change that value afterwards later down in the code – for example in any environment config file.
https://github.com/roots/bedrock/blob/master/web/wp-config.php
But even if I would use regular WordPress architecture with nice original wp-config – I still would not be able to set WP_CACHE settings based on any condition as your plugin is rewriting the config in a “hard” way (by extracting that line to to the top).
Thank you for all your help! ??