|
|
|
@ -1140,7 +1140,7 @@ class Command extends Component
|
|
|
|
|
if (is_array($info)) { |
|
|
|
|
/* @var $cache \yii\caching\CacheInterface */ |
|
|
|
|
$cache = $info[0]; |
|
|
|
|
$cacheKey = $this->getCacheKey($method, $fetchMode, $rawSql); |
|
|
|
|
$cacheKey = $this->getCacheKey($method, $fetchMode); |
|
|
|
|
$result = $cache->get($cacheKey); |
|
|
|
|
if (is_array($result) && isset($result[0])) { |
|
|
|
|
Yii::debug('Query result served from cache', 'yii\db\Command::query'); |
|
|
|
@ -1187,11 +1187,10 @@ class Command extends Component
|
|
|
|
|
* @param string $method method of PDOStatement to be called |
|
|
|
|
* @param int $fetchMode the result fetch mode. Please refer to [PHP manual](https://secure.php.net/manual/en/function.PDOStatement-setFetchMode.php) |
|
|
|
|
* for valid fetch modes. |
|
|
|
|
* @param string $rawSql Deprecated since 2.0.33, the raw SQL with parameter values inserted into the corresponding placeholders |
|
|
|
|
* @return array the cache key |
|
|
|
|
* @since 2.0.16 |
|
|
|
|
*/ |
|
|
|
|
protected function getCacheKey($method, $fetchMode, $rawSql) |
|
|
|
|
protected function getCacheKey($method, $fetchMode) |
|
|
|
|
{ |
|
|
|
|
$params = $this->params; |
|
|
|
|
ksort($params); |
|
|
|
|