Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccessProxy.php
Go to the documentation of this file.
1 <?php
13 
15 {
21  private $_cacheState;
22 
28  private $_identifier;
29 
35  public function __construct(
36  \Magento\Framework\Cache\FrontendInterface $frontend,
37  \Magento\Framework\App\Cache\StateInterface $cacheState,
38  $identifier
39  ) {
40  parent::__construct($frontend);
41  $this->_cacheState = $cacheState;
42  $this->_identifier = $identifier;
43  }
44 
50  protected function _isEnabled()
51  {
52  return $this->_cacheState->isEnabled($this->_identifier);
53  }
54 
58  public function test($identifier)
59  {
60  if (!$this->_isEnabled()) {
61  return false;
62  }
63  return parent::test($identifier);
64  }
65 
69  public function load($identifier)
70  {
71  if (!$this->_isEnabled()) {
72  return false;
73  }
74  return parent::load($identifier);
75  }
76 
80  public function save($data, $identifier, array $tags = [], $lifeTime = null)
81  {
82  if (!$this->_isEnabled()) {
83  return true;
84  }
85  return parent::save($data, $identifier, $tags, $lifeTime);
86  }
87 
91  public function remove($identifier)
92  {
93  if (!$this->_isEnabled()) {
94  return true;
95  }
96  return parent::remove($identifier);
97  }
98 
102  public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = [])
103  {
104  if (!$this->_isEnabled()) {
105  return true;
106  }
107  return parent::clean($mode, $tags);
108  }
109 }
__construct(\Magento\Framework\Cache\FrontendInterface $frontend, \Magento\Framework\App\Cache\StateInterface $cacheState, $identifier)
Definition: AccessProxy.php:35
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
const CLEANING_MODE_ALL
Definition: Cache.php:72
save($data, $identifier, array $tags=[], $lifeTime=null)
Definition: AccessProxy.php:80
clean($mode=\Zend_Cache::CLEANING_MODE_ALL, array $tags=[])