Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Zend Class Reference
Inheritance diagram for Zend:
FrontendInterface

Public Member Functions

 __construct (\Closure $frontendFactory)
 
 test ($identifier)
 
 load ($identifier)
 
 save ($data, $identifier, array $tags=[], $lifeTime=null)
 
 remove ($identifier)
 
 clean ($mode=\Zend_Cache::CLEANING_MODE_ALL, array $tags=[])
 
 getBackend ()
 
 getLowLevelFrontend ()
 

Protected Member Functions

 _unifyId ($identifier)
 
 _unifyIds (array $ids)
 

Protected Attributes

 $_frontend
 

Detailed Description

Adapter for Magento -> Zend cache frontend interfaces

Definition at line 11 of file Zend.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Closure  $frontendFactory)
Parameters
\Closure$frontendFactory

Definition at line 35 of file Zend.php.

36  {
37  $this->frontendFactory = $frontendFactory;
38  $this->_frontend = $frontendFactory();
39  $this->pid = getmypid();
40  }

Member Function Documentation

◆ _unifyId()

_unifyId (   $identifier)
protected

Retrieve single unified identifier

Parameters
string$identifier
Returns
string

Definition at line 121 of file Zend.php.

122  {
123  return strtoupper($identifier);
124  }

◆ _unifyIds()

_unifyIds ( array  $ids)
protected

Retrieve multiple unified identifiers

Parameters
array$ids
Returns
array

Definition at line 132 of file Zend.php.

133  {
134  foreach ($ids as $key => $value) {
135  $ids[$key] = $this->_unifyId($value);
136  }
137  return $ids;
138  }
$value
Definition: gender.phtml:16

◆ clean()

clean (   $mode = \Zend_Cache::CLEANING_MODE_ALL,
array  $tags = [] 
)

{Clean cache records matching specified tags

Parameters
string$mode
array$tags
Returns
bool @api
}

Exceptions

Implements FrontendInterface.

Definition at line 80 of file Zend.php.

81  {
82  // Cleaning modes 'old' and 'notMatchingTag' are prohibited as a trade off for decoration reliability
83  if (!in_array(
84  $mode,
85  [
89  ]
90  )
91  ) {
92  throw new \InvalidArgumentException(
93  "Magento cache frontend does not support the cleaning mode '{$mode}'."
94  );
95  }
96  return $this->getFrontEnd()->clean($mode, $this->_unifyIds($tags));
97  }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
const CLEANING_MODE_ALL
Definition: Cache.php:72
const CLEANING_MODE_MATCHING_ANY_TAG
Definition: Cache.php:76
const CLEANING_MODE_MATCHING_TAG
Definition: Cache.php:74

◆ getBackend()

getBackend ( )

{Retrieve backend instance

Returns
\Zend_Cache_Backend_Interface
}

Implements FrontendInterface.

Definition at line 102 of file Zend.php.

103  {
104  return $this->getFrontEnd()->getBackend();
105  }

◆ getLowLevelFrontend()

getLowLevelFrontend ( )

{Retrieve frontend instance compatible with Zend Locale Data setCache() to be used as a workaround

Returns
\Zend_Cache_Core
}

Implements FrontendInterface.

Definition at line 110 of file Zend.php.

111  {
112  return $this->getFrontEnd();
113  }

◆ load()

load (   $identifier)

{Load cache record by its unique identifier

Parameters
string$identifier
Returns
string|bool @api
}

Implements FrontendInterface.

Definition at line 53 of file Zend.php.

54  {
55  return $this->getFrontEnd()->load($this->_unifyId($identifier));
56  }

◆ remove()

remove (   $identifier)

{Remove cache record by its unique identifier

Parameters
string$identifier
Returns
bool @api
}

Implements FrontendInterface.

Definition at line 69 of file Zend.php.

70  {
71  return $this->getFrontEnd()->remove($this->_unifyId($identifier));
72  }

◆ save()

save (   $data,
  $identifier,
array  $tags = [],
  $lifeTime = null 
)

{Save cache record

Parameters
string$data
string$identifier
array$tags
int | bool | null$lifeTime
Returns
bool @api
}

Implements FrontendInterface.

Definition at line 61 of file Zend.php.

62  {
63  return $this->getFrontEnd()->save($data, $this->_unifyId($identifier), $this->_unifyIds($tags), $lifeTime);
64  }

◆ test()

test (   $identifier)

{Test if a cache is available for the given id

Parameters
string$identifierCache id
Returns
int|bool Last modified time of cache entry if it is available, false otherwise
}

Implements FrontendInterface.

Definition at line 45 of file Zend.php.

46  {
47  return $this->getFrontEnd()->test($this->_unifyId($identifier));
48  }

Field Documentation

◆ $_frontend

$_frontend
protected

Definition at line 16 of file Zend.php.


The documentation for this class was generated from the following file: