0

I have a scenario where I save a variable to the core_config_data table using an \Magento\Config\Model\ResourceModel\Config object:

$this->_resourceConfig->saveConfig(
                'mycompany/configuration/token',
                $token,
                'default',
                0
            );

then I clean the cache using \Magento\Framework\App\Cache\Manager and Magento\Framework\App\Cache\Type\Config objects:

$this->_cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);

Immediately, I redirect to another page that recalls the the same config variable, but it's null.

How do we make sure the cache cleaning finished before trying to read config data?

2
  • can you show your code, how your saving the value Commented Jan 21, 2017 at 1:36
  • @MeenakshiSundaram R, I use a resourceConfig object to save to the variable. This is my current understanding on how to do it. Is this right? Commented Jan 23, 2017 at 15:36

1 Answer 1

0

I'm not sure if this was definitively solved, but after I upgraded to Magento 2.16, the issue was resolved. The coreConfig items are present between page loads now.

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.