使用CActiveDataProvider获取缓存

时间:2014-02-20 17:31:54

标签: php yii cactivedataprovider

我能够在缓存中使用“CActiveDataProvider”存储查询,但看起来它不是从缓存中获取的,我做错了什么?

我的配置是:

'cache'=>array(
            'class'=>'CFileCache',
        ),

控制器:

$dependecy = new CDbCacheDependency('SELECT MAX(id) FROM {{table}}');

    $dataProvider = new CActiveDataProvider(Model::model()->cache(3600, $dependecy, 2), array ( 
        'criteria' => array ( 
            'order'=>'date DESC',
        ),
        'pagination' => array ( 
                //'pageSize' => '5',
        ),
    ));

0 个答案:

没有答案