Yii Framework Forum: Cdbcachedependency - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cdbcachedependency

#1 User is offline   theex 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 12

Posted 08 July 2013 - 05:34 AM

Not a bug, my fault.

I set dependency as I did in filters() in Cchainedcachedepenecy but for Active Record it have to be done in difference ways



------------------------------------------------------------------------------
O.S. = Linux version 3.2.13-grsec-xxxx-grs-ipv6-32 (root@kernel-32.ovh.net) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP Thu Mar 29 09:43:21 UTC 2012
Web Server = Apache/2.2.16 (Debian)
Browser = Chrome Version 28.0.1500.71
Yii-version = 1.1.14-dev

In a action i cache some data with db dependency.
Yii::app()->cache->set(
	$cid,
	$terms[Yii::app()->language],
	3600*24*30, 
	array(
		'class'=>'CDbCacheDependency',
		'sql'=> 'SELECT MAX(id) FROM term WHERE vocabulary_id=:vocabulary_id',
		'params' => array(':vocabulary_id'=>$vid),
	)
);



After this if I restart apache and refresh the page only trace output is showed.
In my php log error i found:
PHP Fatal error: Call to a member function evaluateDependency() on a non-object in /usr/share/yii-latest/caching/CCache.php on line 178

CCache.php
173:public function set($id,$value,$expire=0,$dependency=null)
174:{
175:	Yii::trace('Saving "'.$id.'" to cache','system.caching.'.get_class($this));
176:
177:    if ($dependency !== null && $this->serializer !== false)
178:    	$dependency->evaluateDependency();
179:	if ($this->serializer === null)
180:		$value = serialize(array($value,$dependency));
181:	elseif ($this->serializer !== false)
182:		$value = call_user_func($this->serializer[0], array($value,$dependency));
183:
184:	return $this->setValue($this->generateUniqueKey($id), $value, $expire);
185:}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users