mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fixes #7211: Query caching should properly deal with the case when query result is false
This commit is contained in:
@ -11,6 +11,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #7037: `yii\console\controllers\AssetController` now correctly handles relative image URLs if source and target CSS are under same directory (klimov-paul)
|
||||
- Bug #7055: composite IN condition was not generated correctly for certain DBMS (nineinchnick)
|
||||
- Bug #7074: `yii\data\ArrayDataProvider` did not correctly handle the case `Pagination::pageSize = 0` (kirsenn, qiangxue)
|
||||
- Bug #7211: Query caching should properly deal with the case when query result is false (qiangxue)
|
||||
- Bug #7218: `yii\captcha\CaptchaAction` should send response in JSON format (InteLigent, qiangxue)
|
||||
- Bug #7226: `yii\web\Request::getEtag()` should strip off `-gzip` which may be added by Apache (mcd-php)
|
||||
- Bug #7227: Query builder should respect column alias setting when `yii\db\Expression` is being selected (mdmunir, qiangxue)
|
||||
|
@ -805,9 +805,10 @@ class Command extends Component
|
||||
$this->db->username,
|
||||
$rawSql,
|
||||
];
|
||||
if (($result = $cache->get($cacheKey)) !== false) {
|
||||
$result = $cache->get($cacheKey);
|
||||
if (is_array($result) && isset($result[0])) {
|
||||
Yii::trace('Query result served from cache', 'yii\db\Command::query');
|
||||
return $result;
|
||||
return $result[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -837,7 +838,7 @@ class Command extends Component
|
||||
}
|
||||
|
||||
if (isset($cache, $cacheKey, $info)) {
|
||||
$cache->set($cacheKey, $result, $info[1], $info[2]);
|
||||
$cache->set($cacheKey, [$result], $info[1], $info[2]);
|
||||
Yii::trace('Saved query result in cache', 'yii\db\Command::query');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user