ActiveRecord Caching

What is the proper way to do ActiveRecord caching with timeout and dependency? In Yii 1 I would do something like this:

$cache_time = 60;

$dependency = new CDbCacheDependency('SELECT update_time FROM table WHERE id = :id');

$dependency->params = array('id' => $id);

$model = Something::model()->cache($cache_time, $dependency )->findByPk($id);


	throw new CHttpException(404,'The requested ID does not exist.');

return $model;


Yes, I spent a long time studying that before I posted the message. It’s doesn’t explain how to do what I’m looking for.

Which part are you struggling with then?