FPC will clear all the session be clear and we possible via Magento\Framework\App\Http\Context or via Magento\Customer\Model\Session.
However, result may be different:
HTTP context is initialized earlier than customer session (but it does not matter since both are initialized in action controllers)When PageCache module is on (probably always on production), keep in mind that as soon as layout generation started, customer session will be cleared by \Magento\PageCache\Model\Layout\DepersonalizePlugin::afterGenerateXml on all cacheable pages. It means that if you now check if customer is logged in via HTTP context, it will still say ‘yes’, but customer data will not be available in customer
check code in
** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Model; class Context { /** * Customer group cache context */ const CONTEXT_GROUP = 'customer_group'; /** * Customer authorization cache context */ const CONTEXT_AUTH = 'customer_logged_in'; } ----
namespace Magento\Customer\Block\Account; use Magento\Customer\Api\CustomerRepositoryInterface;
class Customer extends \Magento\Framework\View\Element\Template { .......... /** * Checking customer login status * * @return bool */ public function customerLoggedIn() { return (bool)$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH); } } ------
<?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Model; ...... class Session extends \Magento\Framework\Session\SessionManager { /**
......
*/ .......
/** * @param CustomerData $customer * @return $this */
public function setCustomerDataAsLoggedIn($customer) { $this->_httpContext->setValue(Context::CONTEXT_AUTH, true, false); ............ return $this; }
/** * The next line is a workaround. * It is used to distinguish users that are logged in from user data set via methods similar to setCustomerId() */ $this->unsIsCustomerEmulated(); return $this; } ........
/** * Logout customer * * @api * @return $this */ public function logout() { ..... $this->_httpContext->unsValue(Context::CONTEXT_AUTH); return $this; }