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);
if($model===null)
throw new CHttpException(404,'The requested ID does not exist.');
return $model;
Thanks.