以这段代码为例:
public function actionPostOneWay( $postId )
{
$dependency = new CDbCacheDependency( 'SELECT publish_date FROM posts WHERE id = :post_id;' );
$dependency->params = array( 'post_id'=>$postId );
$post = Post::model()->cache( 59, $dependency )->findByPk( $postId );
// process post one way
}
public function actionPostAnotherWay( $postId )
{
$dependency = new CDbCacheDependency( 'SELECT publish_date FROM posts WHERE id = :post_id;' );
$dependency->params = array( 'post_id'=>$postId );
$post = Post::model()->cache( 59, $dependency )->findByPk( $postId );
// process post another way
}
那么访问/postOneWay
和/postAnotherWay
重用同一个缓存对象,还是他们会创建自己的缓存对象?