public static function a(){
$dependency=new CDbCacheDependency('SELECT AVG(UNIX_TIMESTAMP(last_updated)) FROM {{post}}');
$criteria=new CDbCriteria;
$criteria->select='post_id,title';
$criteria->order='post_id DESC';
$models=self::model()->cache(1000,$dependency)->findAll($criteria);
return $models;
}
public static function b(){
$dependency=new CDbCacheDependency('SELECT AVG(UNIX_TIMESTAMP(last_updated)) FROM {{post}}');
$criteria=new CDbCriteria;
$criteria->order='post_id DESC';
$models=self::model()->cache(1000,$dependency)->findAll($criteria);
return $models;
}
Then, somewhere in a widget, let's call it widget A i call:
$models=Post::a();
then the posts will be cached, each post model having only the post_id and title attributes loaded.
Next, if in another widget, let's call it widget B, which gets called after widget A has been called, i do:
$models=Post::b();
because i want to get all the post attributes, not only the title and post_id(like i did in widget A), then i only get the post_id and the post title, because the dependency has been evaluated in Post::a() and used in Post::b() which is not correct.
How can i avoid this behavior ?

Help













