yiisoft/yii — pull request #686 by DaSourcerer (2012-05-06 16:28:58+00:00)
Title: Enable HTTP caching

This is related to issue #552: This PR will enable http-level caching via a filter. If it gets pulled, I'll write a section for the Yii guide concerning this.

Using the blog demo, I could reduce loading times for the startpage from ~100ms to less than 20ms with SQLite as backend. All I had to do was modifying the `PostController.filters()` method to this:
```php
public function filters()
{
return array(
'accessControl', // perform access control for CRUD operations
array(
'CHttpCacheFilter + index',
'lastModifiedExpression'=>'Yii::app()->db->createCommand("SELECT MAX(`update_time`) FROM {{post}} WHERE `status`=:status")->queryScalar(array(":status"=>Post::STATUS_PUBLISHED))',
),
);
}
```