26 #require_once 'Zend/Cache/Core.php'; 56 'cached_entity' =>
null,
57 'cache_by_default' =>
true,
58 'cached_methods' => array(),
59 'non_cached_methods' => array()
112 if ($this->_specificOptions[
'cached_entity'] ===
null) {
116 $this->
setOption(
'automatic_serialization',
true);
127 $this->_specificLifetime = $specificLifetime;
137 $this->_priority = $priority;
152 if (
$name ==
'cached_entity') {
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();
194 $this->_tags = $tags;
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) {
259 private function _makeId(
$name, $args)
273 return md5($this->_cachedEntityLabel .
'__' .
$name .
'__' . serialize($args));
save($data, $id=null, $tags=array(), $specificLifetime=false, $priority=8)
setSpecificLifetime($specificLifetime=false)
__construct(array $options=array())
setCachedEntity($cachedEntity)
static throwException($msg, Exception $e=null)
makeId($name, array $args=array())
__call($name, $parameters)
setTagsArray($tags=array())
load($id, $doNotTestCacheValidity=false, $doNotUnserialize=false)
if(!isset($_GET['name'])) $name