This questions interests me as well. If I have something like:
$dataProvider = new CActiveDataProvider(Album::model()->cache($duration, $dependency, 2), array(
'criteria' => $criteria,
));
How can I possibly set/access the cache key so I can manually unset it later on? I don’t/can’t depend entirely in the $dependency to do that for me.
Why can’t rely entirely in the $dependency object? I have a is_deleted column in the Album table, so when the user ‘erases’ an album, I update the is_deleted to TRUE and the update_time (which is the core of my dependency query). Now, when the user erases his account, I want to erase the Albums, not update is_deleted. And when I do that, the set returned from the cache is inconsistent with the database.
It’d be really good if there was a way of doing something like:
$dataProvider = new CActiveDataProvider(Album::model()->cache($myKey, $duration, $dependency, 2), array(