Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Zend_Cache_Backend_ZendServer Class Reference
Inheritance diagram for Zend_Cache_Backend_ZendServer:
Zend_Cache_Backend Zend_Cache_Backend_Interface Zend_Cache_Backend_ZendServer_Disk Zend_Cache_Backend_ZendServer_ShMem

Public Member Functions

 load ($id, $doNotTestCacheValidity=false)
 
 test ($id)
 
 save ($data, $id, $tags=array(), $specificLifetime=false)
 
 remove ($id)
 
 clean ($mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array())
 
- Public Member Functions inherited from Zend_Cache_Backend
 __construct (array $options=array())
 
 setDirectives ($directives)
 
 setOption ($name, $value)
 
 getOption ($name)
 
 getLifetime ($specificLifetime)
 
 isAutomaticCleaningAvailable ()
 
 getTmpDir ()
 
- Public Member Functions inherited from Zend_Cache_Backend_Interface
 setDirectives ($directives)
 

Protected Member Functions

 _store ($data, $id, $timeToLive)
 
 _fetch ($id)
 
 _unset ($id)
 
 _clear ()
 
- Protected Member Functions inherited from Zend_Cache_Backend
 _isGoodTmpDir ($dir)
 
 _loggerSanity ()
 
 _log ($message, $priority=4)
 

Protected Attributes

 $_options
 
- Protected Attributes inherited from Zend_Cache_Backend
 $_directives
 
 $_options = array()
 

Detailed Description

Definition at line 37 of file ZendServer.php.

Member Function Documentation

◆ _clear()

_clear ( )
abstractprotected

Clear cache

◆ _fetch()

_fetch (   $id)
abstractprotected

Fetch data

Parameters
string$idCache id
Exceptions
Zend_Cache_Exception

◆ _store()

_store (   $data,
  $id,
  $timeToLive 
)
abstractprotected

Store data

Parameters
mixed$dataObject to store
string$idCache id
int$timeToLiveTime to live in seconds
Exceptions
Zend_Cache_Exception

◆ _unset()

_unset (   $id)
abstractprotected

Unset data

Parameters
string$idCache id

◆ clean()

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

Clean some cache records

Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => unsupported 'matchingTag' => unsupported 'notMatchingTag' => unsupported 'matchingAnyTag' => unsupported

Parameters
string$modeclean mode
array$tagsarray of tags
Exceptions
Zend_Cache_Exception
Returns
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

Definition at line 186 of file ZendServer.php.

187  {
188  switch ($mode) {
190  $this->_clear();
191  return true;
192  break;
194  $this->_log("Zend_Cache_Backend_ZendServer::clean() : CLEANING_MODE_OLD is unsupported by the Zend Server backends.");
195  break;
199  $this->_clear();
200  $this->_log('Zend_Cache_Backend_ZendServer::clean() : tags are unsupported by the Zend Server backends.');
201  break;
202  default:
203  Zend_Cache::throwException('Invalid mode for clean() method');
204  break;
205  }
206  }
const CLEANING_MODE_OLD
Definition: Cache.php:73
_log($message, $priority=4)
Definition: Backend.php:273
const CLEANING_MODE_NOT_MATCHING_TAG
Definition: Cache.php:75
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
const CLEANING_MODE_ALL
Definition: Cache.php:72
static throwException($msg, Exception $e=null)
Definition: Cache.php:205
const CLEANING_MODE_MATCHING_ANY_TAG
Definition: Cache.php:76
const CLEANING_MODE_MATCHING_TAG
Definition: Cache.php:74

◆ load()

load (   $id,
  $doNotTestCacheValidity = false 
)

Test if a cache is available for the given id and (if yes) return it (false else)

Parameters
string$idcache id
boolean$doNotTestCacheValidityif set to true, the cache validity won't be tested
Returns
string cached datas (or false)

Implements Zend_Cache_Backend_Interface.

Definition at line 88 of file ZendServer.php.

89  {
90  $tmp = $this->_fetch($id);
91  if ($tmp !== null) {
92  return $tmp;
93  }
94  return false;
95  }
$id
Definition: fieldset.phtml:14

◆ remove()

remove (   $id)

Remove a cache record

Parameters
string$idcache id
Returns
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

Definition at line 163 of file ZendServer.php.

164  {
165  $result1 = $this->_unset($id);
166  $result2 = $this->_unset('internal-metadatas---' . $id);
167 
168  return $result1 && $result2;
169  }
$id
Definition: fieldset.phtml:14

◆ save()

save (   $data,
  $id,
  $tags = array(),
  $specificLifetime = false 
)

Save some string datas into a cache record

Note : $data is always "string" (serialization is done by the core not by the backend)

Parameters
string$datadatas to cache
string$idcache id
array$tagsarray of strings, the cache record will be tagged by each string entry
int$specificLifetimeif != false, set a specific lifetime for this cache record (null => infinite lifetime)
Returns
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

Definition at line 141 of file ZendServer.php.

142  {
143  $lifetime = $this->getLifetime($specificLifetime);
144  $metadatas = array(
145  'mtime' => time(),
146  'expire' => $this->_expireTime($lifetime),
147  );
148 
149  if (count($tags) > 0) {
150  $this->_log('Zend_Cache_Backend_ZendServer::save() : tags are unsupported by the ZendServer backends');
151  }
152 
153  return $this->_store($data, $id, $lifetime) &&
154  $this->_store($metadatas, 'internal-metadatas---' . $id, $lifetime);
155  }
$id
Definition: fieldset.phtml:14
_log($message, $priority=4)
Definition: Backend.php:273
_store($data, $id, $timeToLive)
getLifetime($specificLifetime)
Definition: Backend.php:143

◆ test()

test (   $id)

Test if a cache is available or not (for the given id)

Parameters
string$idcache id
Returns
mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
Exceptions
Zend_Cache_Exception

Implements Zend_Cache_Backend_Interface.

Definition at line 104 of file ZendServer.php.

105  {
106  $tmp = $this->_fetch('internal-metadatas---' . $id);
107  if ($tmp !== false) {
108  if (!is_array($tmp) || !isset($tmp['mtime'])) {
109  Zend_Cache::throwException('Cache metadata for \'' . $id . '\' id is corrupted' );
110  }
111  return $tmp['mtime'];
112  }
113  return false;
114  }
$id
Definition: fieldset.phtml:14
static throwException($msg, Exception $e=null)
Definition: Cache.php:205

Field Documentation

◆ $_options

$_options
protected
Initial value:
= array(
'namespace' => 'zendframework'
)

Definition at line 47 of file ZendServer.php.


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