/** * @param bool $fixtureResultOne * @param bool $fixtureResultTwo * @param bool $expectedResult * @dataProvider cleanModeMatchingAnyTagDataProvider */ public function testCleanModeMatchingAnyTag($fixtureResultOne, $fixtureResultTwo, $expectedResult) { $this->_frontend->expects($this->at(0))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_one', 'enforced_tag'])->will($this->returnValue($fixtureResultOne)); $this->_frontend->expects($this->at(1))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_two', 'enforced_tag'])->will($this->returnValue($fixtureResultTwo)); $actualResult = $this->_object->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ['test_tag_one', 'test_tag_two']); $this->assertEquals($expectedResult, $actualResult); }
/** * Retrieve cache frontend instance being decorated * * @return \Magento\Framework\Cache\FrontendInterface */ protected function _getFrontend() { $frontend = parent::_getFrontend(); if (!$frontend) { $frontend = $this->cacheFrontendPool->get(self::TYPE_IDENTIFIER); $this->setFrontend($frontend); } return $frontend; }
/** * Returns a frontend on a first call to frontend interface methods * * @SuppressWarnings(PHPMD.CamelCaseMethodName) * * @return FrontendInterface */ protected function _getFrontend() { // @codingStandardsIgnoreEnd $frontend = parent::_getFrontend(); if ($frontend === null) { $frontend = $this->frontendPool->get(self::CACHE_TYPE); } return $frontend; }
/** * @param \Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool */ public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool) { parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG); }
/** * @param FrontendPool $cacheFrontendPool */ public function __construct(FrontendPool $cacheFrontendPool) { parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG); }
/** * @param \Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool * @param StoreManagerInterface $storeManager * @param UserContextInterface $userContext */ public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool, StoreManagerInterface $storeManager, UserContextInterface $userContext) { $this->storeManager = $storeManager; $this->userContext = $userContext; parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG); }
/** * {@inheritdoc} * * @param string $mode * @param array $tags * @return bool */ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = []) { $this->eventManager->dispatch('adminhtml_cache_refresh_type'); return parent::clean($mode, $tags); }