yii\db\Connection::getQueryCacheInfo PHP Method

getQueryCacheInfo() public method

This method is used internally by Command.
public getQueryCacheInfo ( integer $duration, yii\caching\Dependency $dependency ) : array
$duration integer the preferred caching duration. If null, it will be ignored.
$dependency yii\caching\Dependency the preferred caching dependency. If null, it will be ignored.
return array the current query cache information, or null if query cache is not enabled.
    public function getQueryCacheInfo($duration, $dependency)
    {
        if (!$this->enableQueryCache) {
            return null;
        }
        $info = end($this->_queryCacheInfo);
        if (is_array($info)) {
            if ($duration === null) {
                $duration = $info[0];
            }
            if ($dependency === null) {
                $dependency = $info[1];
            }
        }
        if ($duration === 0 || $duration > 0) {
            if (is_string($this->queryCache) && Yii::$app) {
                $cache = Yii::$app->get($this->queryCache, false);
            } else {
                $cache = $this->queryCache;
            }
            if ($cache instanceof Cache) {
                return [$cache, $duration, $dependency];
            }
        }
        return null;
    }