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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.