Hi,
First of all, thank you for creating this fantastic framework.
I am trying to cache queries generated by CActiveDataProvider. Here is the code:
$dependency = new CGlobalStateCacheDependency;
$dependency->stateName = 'Cache.articles';
$dataProvider=new CActiveDataProvider(Articles::model()->cache(3600, $dependency, 2),array(
'criteria'=>array(
'order'=>'id DESC ',
'condition' => 'status = 6 AND id NOT IN '.'('. implode(',', $this->ids) .')',
),
'pagination'=>array(
'pageSize'=>7,
),
));
I think, I have done every thing correct, but still CActiveDataProvider results are not being cached (when i edit the articles that belong to first page, the articles on that listing page should show older data, but they show new one).
Here are the config settings:
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=testdb',
'emulatePrepare' => true,
'username' => 'test',
'password' => 'test',
'charset' => 'utf8',
'queryCacheID' => 'fileCache',
),
'fileCache' => array(
'class' => 'system.caching.CFileCache',
'cacheFileSuffix' => '_test'
),
GlobalState variables are being updated in Articles model afterSave method, but that’s insignificant as the results are not being cached.
Yii version: 1.1.13
Did I miss something…
Thanks