|
| | __construct (array $options=array()) |
| |
| | call ($callback, array $parameters=array(), $tags=array(), $specificLifetime=false, $priority=8) |
| |
| | makeId ($callback, 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 36 of file Function.php.
◆ __construct()
| __construct |
( |
array |
$options = array() | ) |
|
Constructor
- Parameters
-
| array | $options | Associative array of options |
- Returns
- void
Definition at line 64 of file Function.php.
69 $this->
setOption(
'automatic_serialization',
true);
if(!isset($_GET['name'])) $name
◆ call()
| call |
( |
|
$callback, |
|
|
array |
$parameters = array(), |
|
|
|
$tags = array(), |
|
|
|
$specificLifetime = false, |
|
|
|
$priority = 8 |
|
) |
| |
Main method : call the specified function or get the result from cache
- Parameters
-
| callback | $callback | A valid callback |
| array | $parameters | Function parameters |
| array | $tags | Cache tags |
| int | $specificLifetime | If != false, set a specific lifetime for this cache record (null => infinite lifetime) |
| int | $priority | integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends |
- Returns
- mixed Result
Definition at line 82 of file Function.php.
84 if (!is_callable($callback,
true,
$name)) {
88 $cacheBool1 = $this->_specificOptions[
'cache_by_default'];
89 $cacheBool2 = in_array(
$name, $this->_specificOptions[
'cached_functions']);
90 $cacheBool3 = in_array(
$name, $this->_specificOptions[
'non_cached_functions']);
91 $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3));
94 return call_user_func_array($callback, $parameters);
97 $id = $this->_makeId($callback, $parameters);
98 if ( ($rs = $this->
load(
$id)) && isset($rs[0], $rs[1])) {
105 ob_implicit_flush(
false);
106 $return = call_user_func_array($callback, $parameters);
109 $this->
save(
$data,
$id, $tags, $specificLifetime, $priority);
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
static throwException($msg, Exception $e=null)
load($id, $doNotTestCacheValidity=false, $doNotUnserialize=false)
if(!isset($_GET['name'])) $name
◆ makeId()
| makeId |
( |
|
$callback, |
|
|
array |
$args = array() |
|
) |
| |
Make a cache id from the function name and parameters
- Parameters
-
| callback | $callback | A valid callback |
| array | $args | Function parameters |
- Exceptions
-
- Returns
- string Cache id
Definition at line 134 of file Function.php.
136 if (!is_callable($callback,
true,
$name)) {
144 if (is_object($callback)) {
146 }
elseif (isset($callback[0])) {
147 $object = $callback[0];
149 if (isset($object)) {
151 $tmp = @serialize($callback);
152 }
catch (Exception $e) {
156 $lastErr = error_get_last();
166 $argsStr = @serialize(array_values($args));
167 }
catch (Exception $e) {
171 $lastErr = error_get_last();
176 return md5(
$name . $argsStr);
elseif(isset( $params[ 'redirect_parent']))
static throwException($msg, Exception $e=null)
if(!isset($_GET['name'])) $name
◆ $_specificOptions
Initial value:= array(
'cache_by_default' => true,
'cached_functions' => array(),
'non_cached_functions' => array()
)
Definition at line 52 of file Function.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Cache/Frontend/Function.php