|
| | __construct (array $options=array()) |
| |
| | setSpecificLifetime ($specificLifetime=false) |
| |
| | setPriority ($priority) |
| |
| | setOption ($name, $value) |
| |
| | setCachedEntity ($cachedEntity) |
| |
| | setTagsArray ($tags=array()) |
| |
| | __call ($name, $parameters) |
| |
| | makeId ($name, array $args=array()) |
| |
| | __construct ($options=array()) |
| |
| | setConfig (Zend_Config $config) |
| |
| | setBackend (Zend_Cache_Backend $backendObject) |
| |
| | getBackend () |
| |
| | setOption ($name, $value) |
| |
| | getOption ($name) |
| |
| | setLifetime ($newLifetime) |
| |
| | load ($id, $doNotTestCacheValidity=false, $doNotUnserialize=false) |
| |
| | test ($id) |
| |
| | save ($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8) |
| |
| | remove ($id) |
| |
| | clean ($mode='all', $tags=array()) |
| |
| | getIdsMatchingTags ($tags=array()) |
| |
| | getIdsNotMatchingTags ($tags=array()) |
| |
| | getIdsMatchingAnyTags ($tags=array()) |
| |
| | getIds () |
| |
| | getTags () |
| |
| | getFillingPercentage () |
| |
| | getMetadatas ($id) |
| |
| | touch ($id, $extraLifetime) |
| |
Definition at line 35 of file Class.php.
◆ __construct()
| __construct |
( |
array |
$options = array() | ) |
|
Constructor
- Parameters
-
| array | $options | Associative array of options |
- Exceptions
-
Definition at line 107 of file Class.php.
112 if ($this->_specificOptions[
'cached_entity'] ===
null) {
116 $this->
setOption(
'automatic_serialization',
true);
setCachedEntity($cachedEntity)
static throwException($msg, Exception $e=null)
if(!isset($_GET['name'])) $name
◆ __call()
| __call |
( |
|
$name, |
|
|
|
$parameters |
|
) |
| |
Main method : call the specified method or get the result from cache
- Parameters
-
| string | $name | Method name |
| array | $parameters | Method parameters |
- Returns
- mixed Result
- Exceptions
-
Definition at line 205 of file Class.php.
207 $callback = array($this->_cachedEntity,
$name);
209 if (!is_callable($callback,
false)) {
213 $cacheBool1 = $this->_specificOptions[
'cache_by_default'];
214 $cacheBool2 = in_array(
$name, $this->_specificOptions[
'cached_methods']);
215 $cacheBool3 = in_array(
$name, $this->_specificOptions[
'non_cached_methods']);
216 $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3));
220 return call_user_func_array($callback, $parameters);
224 if (($rs = $this->
load(
$id)) && (array_key_exists(0, $rs))
225 && (array_key_exists(1, $rs))
233 ob_implicit_flush(
false);
236 $return = call_user_func_array($callback, $parameters);
241 $data,
$id, $this->_tags, $this->_specificLifetime,
244 }
catch (Exception $e) {
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
static throwException($msg, Exception $e=null)
makeId($name, array $args=array())
load($id, $doNotTestCacheValidity=false, $doNotUnserialize=false)
if(!isset($_GET['name'])) $name
◆ makeId()
| makeId |
( |
|
$name, |
|
|
array |
$args = array() |
|
) |
| |
Make a cache id from the method name and parameters
- Parameters
-
| string | $name | Method name |
| array | $args | Method parameters |
- Returns
- string Cache id
Definition at line 271 of file Class.php.
273 return md5($this->_cachedEntityLabel .
'__' .
$name .
'__' . serialize($args));
if(!isset($_GET['name'])) $name
◆ setCachedEntity()
| setCachedEntity |
( |
|
$cachedEntity | ) |
|
Specific method to set the cachedEntity
if set to a class name, we will cache an abstract class and will use only static calls if set to an object, we will cache this object methods
- Parameters
-
Definition at line 167 of file Class.php.
169 if (!is_string($cachedEntity) && !is_object($cachedEntity)) {
171 'cached_entity must be an object or a class name' 175 $this->_cachedEntity = $cachedEntity;
176 $this->_specificOptions[
'cached_entity'] = $cachedEntity;
178 if (is_string($this->_cachedEntity)) {
181 $ro =
new ReflectionObject($this->_cachedEntity);
182 $this->_cachedEntityLabel = $ro->getName();
static throwException($msg, Exception $e=null)
◆ setOption()
| setOption |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Public frontend to set an option
Just a wrapper to get a specific behaviour for cached_entity
- Parameters
-
| string | $name | Name of the option |
| mixed | $value | Value of the option |
- Exceptions
-
- Returns
- void
Definition at line 150 of file Class.php.
152 if (
$name ==
'cached_entity') {
setCachedEntity($cachedEntity)
if(!isset($_GET['name'])) $name
◆ setPriority()
Set the priority (used by some particular backends)
- Parameters
-
| int | $priority | integer between 0 (very low priority) and 10 (maximum priority) |
Definition at line 135 of file Class.php.
137 $this->_priority = $priority;
◆ setSpecificLifetime()
| setSpecificLifetime |
( |
|
$specificLifetime = false | ) |
|
Set a specific life time
- Parameters
-
| bool | int | $specificLifetime | |
- Returns
- void
Definition at line 125 of file Class.php.
127 $this->_specificLifetime = $specificLifetime;
◆ setTagsArray()
| setTagsArray |
( |
|
$tags = array() | ) |
|
Set the cache array
- Parameters
-
- Returns
- void
Definition at line 192 of file Class.php.
194 $this->_tags = $tags;
◆ $_cachedEntity
◆ $_cachedEntityLabel
◆ $_priority
◆ $_specificLifetime
| $_specificLifetime = false |
|
protected |
◆ $_specificOptions
Initial value:= array(
'cached_entity' => null,
'cache_by_default' => true,
'cached_methods' => array(),
'non_cached_methods' => array()
)
Definition at line 55 of file Class.php.
◆ $_tags
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Cache/Frontend/Class.php