I am creating a module that clears invalidated cache,
I am trying to get invalidated cache types in controller, so i can clear cache for only cache types which are invalidated.
How to invalidated cache types in controller ?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityCheck out how Magento does it when rendering the caches in vendor/magento/module-backend/Block/Cache/Grid/Column/Statuses.php
.
Basically, it injects the \Magento\Framework\App\Cache\TypeListInterface
class in constructor and it retrieves the list of invalidated caches by calling the method of the concrete class vendor/magento/framework/App/Cache/TypeList.php
which implements the method:
$this->_cacheTypeList->getInvalidated()