27 #require_once 'Zend/Cache/Core.php'; 53 'cache_by_default' =>
true,
54 'cached_functions' => array(),
55 'non_cached_functions' => array()
69 $this->
setOption(
'automatic_serialization',
true);
82 public function call($callback, array $parameters = array(), $tags = array(), $specificLifetime =
false, $priority = 8)
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);
121 private function _makeId($callback, array $args)
123 return $this->
makeId($callback, $args);
134 public function makeId($callback, array $args = array())
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']))
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
makeId($callback, array $args=array())
static throwException($msg, Exception $e=null)
call($callback, array $parameters=array(), $tags=array(), $specificLifetime=false, $priority=8)
load($id, $doNotTestCacheValidity=false, $doNotUnserialize=false)
__construct(array $options=array())
if(!isset($_GET['name'])) $name