yii\db\Connection::noCache PHP 메소드

noCache() 공개 메소드

Queries performed within the callable will not use query cache at all. For example, php $db->cache(function (Connection $db) { ... queries that use query cache ... return $db->noCache(function (Connection $db) { this query will not use query cache return $db->createCommand('SELECT * FROM customer WHERE id=1')->queryOne(); }); });
또한 보기: enableQueryCache
또한 보기: queryCache
또한 보기: cache()
public noCache ( callable $callable ) : mixed
$callable callable a PHP callable that contains DB queries which should not use query cache. The signature of the callable is `function (Connection $db)`.
리턴 mixed the return result of the callable
    public function noCache(callable $callable)
    {
        $this->_queryCacheInfo[] = false;
        try {
            $result = call_user_func($callable, $this);
            array_pop($this->_queryCacheInfo);
            return $result;
        } catch (\Exception $e) {
            array_pop($this->_queryCacheInfo);
            throw $e;
        }
    }