Question

I need to save/retrieve information gathered my module. The information might be anything big or small. There may be one or many variables to save and retrieve.

I have identified three ways to save a module state in Magento :

  1. Using Config (core_config_data).
  2. Using Variable (variables) also known as "Custom variables".
  3. Using own resources using a new table in the database.

Which one should I use to save a module state? Are there known best practice for this scenario?

No correct solution

OTHER TIPS

If you need to store data temporarily between script executions or sessions, you might want to look at FlagManager. Data is stored in the flag table.

Usages in core: https://github.com/magento/magento2/search?q=flagManager-%3EsaveFlag&unscoped_q=flagManager-%3EsaveFlag

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top