There are a lot of session types in magento 2 . The ones I know of are listed below ;

1)  \Magento\Catalog\Model\Session //vendor/magento/module-catalog/Model/Session.php

2) \Magento\Newsletter\Model\Session //vendor/magento/module-newsletter/Model/Session.php

3) \Magento\Persistent\Model\Session //vendor/magento/module-persistent/Model/Session.php

4) \Magento\Customer\Model\Session //vendor/magento/module-customer/Model/Session.php

5) \Magento\Backend\Model\Session //vendor/magento/module-backend/Model/Session.php

6) \Magento\Checkout\Model\Session //vendor/magento/module-checkout/Model/Session.php

Can someone please tell me about lifetime, scope and general usage for these sessions, so I can know which session to use when?

1 Answer 1


Magento 2 provides five types of sessions:

Magento\Backend\Model\Session - This session is used for the Magento backend.

Magento\Catalog\Model\Session - Catalog session is used for the frontend for product filters.

Magento\Checkout\Model\Session - Checkout session is used to store checkout-related information.

Magento\Customer\Model\Session - Customer session is used for customer, frontend login, and all other activities.

Magento\Newsletter\Model\Session - For newsletter data.

Magento\Persistent\Model\Session - Persistent session data is kept in DB - so it’s not deleted in some days and is kept for as much time as we need. DB session keeps customerId + some data from real customer session that we want to sync (e.g. num items in shopping cart).

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.