Session and cookies

Sessions in Magento conform to Magento\Framework\Session\SessionManagerInterface. In the app/etc/di.xml file, there is a definition preference for the SessionManagerInterface class which points to the Magento\Framework\Session\Generic class type. The Session\Generic class is just an empty class that extends the Magento\Framework\Session\SessionManager class, which in turn implements the SessionManagerInterface class.

There is one important object that gets instantiated in the SessionManager instance that conforms to \Magento\Framework\Session\Config\ConfigInterface. On looking at app/etc/di.xml file, we can see a preference for ConfigInterface pointing to a Magento\Framework\Session\Config class type.

Tip

To fully understand the ...

Get Magento 2 Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.