PHP code example of dakzilla / magento2-cachetags-helper

1. Go to this page and download the library: Download dakzilla/magento2-cachetags-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dakzilla / magento2-cachetags-helper example snippets


class Cron {
     protected $_cache;

     public function __construct(
            \Magento\Framework\Cache\FrontendInterface $cache
        ) {
            $this->_cache = $cache;
        }
        
     public function execute() {
        $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['cms_page_2']); // default home page tag in 2.1.x
     }
}