mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixed query and schema caching renamings.
This commit is contained in:
@ -106,12 +106,11 @@ class DbCache extends Cache
|
||||
->from($this->cacheTableName)
|
||||
->where('id = :id AND (expire = 0 OR expire > :time)', array(':id' => $key, ':time' => time()));
|
||||
$db = $this->getDbConnection();
|
||||
if ($db->queryCachingDuration >= 0) {
|
||||
if ($db->enableQueryCache) {
|
||||
// temporarily disable and re-enable query caching
|
||||
$duration = $db->queryCachingDuration;
|
||||
$db->queryCachingDuration = -1;
|
||||
$db->enableQueryCache = false;
|
||||
$result = $query->createCommand($db)->queryScalar();
|
||||
$db->queryCachingDuration = $duration;
|
||||
$db->enableQueryCache = true;
|
||||
return $result;
|
||||
} else {
|
||||
return $query->createCommand($db)->queryScalar();
|
||||
@ -135,11 +134,10 @@ class DbCache extends Cache
|
||||
->andWhere("expire = 0 OR expire > " . time() . ")");
|
||||
|
||||
$db = $this->getDbConnection();
|
||||
if ($db->queryCachingDuration >= 0) {
|
||||
$duration = $db->queryCachingDuration;
|
||||
$db->queryCachingDuration = -1;
|
||||
if ($db->enableQueryCache) {
|
||||
$db->enableQueryCache = false;
|
||||
$rows = $query->createCommand($db)->queryAll();
|
||||
$db->queryCachingDuration = $duration;
|
||||
$db->enableQueryCache = true;
|
||||
} else {
|
||||
$rows = $query->createCommand($db)->queryAll();
|
||||
}
|
||||
|
Reference in New Issue
Block a user