Wednesday 8 May 2019

Magento 2 full page cache invalidates every time

We have found a quick fix without any issues. Go To this file and update below changes.

/vendor/magento/module-page-cache/Observer/FlushCacheByTags.php

Line no 57
Replace this function
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) {
            $object = $observer->getEvent()->getObject();
            if (!is_object($object)) {
                return;
            }
            $tags = $this->getTagResolver()->getTags($object);

            if (!empty($tags)) {
                $this->getCache()->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array_unique($tags));
            }
        }
    }
 
 
To

 
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) {
            $object = $observer->getEvent()->getObject();
            if (!is_object($object)) {
                return;
            }
            $tags = $this->getTagResolver()->getTags($object);

            if (!empty($tags)) {
                $this->getCache()->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array_unique($tags));
            }
        }
    }
   

 In both function change only  CLEANING_MODE_MATCHING_ANY_TAG from CLEANING_MODE_MATCHING_TAG   
   
After the update a code it's working in my case.

Magento2 : Reset/Change Magento2 admin password

Solution 1.
Go to phpMyAdmin, select the corresponding database and find admin_user table run the foloing query

UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxxNewpassword', 256), ':xxxxxxxx:1') WHERE username = ‘adminusername';

Note that each xxxxxxxx sequence should be replaced with any random characters.

Solution 2.
Forgot your password? You can change your forgotten or lost password for the admin account.