db\Connection noCache()

noCache() public method

Disables query cache temporarily.

Queries performed within the callable will not use query cache at all. For example,

$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();
    });
});

See also:

public mixed noCache ( callable $callable )
$callable callable

A PHP callable that contains DB queries which should not use query cache. The signature of the callable is function (Connection $db).

return mixed

The return result of the callable

throws Exception

if there is any exception during query

doc_Yii
2016-10-30 16:57:50
Comments
Leave a Comment

Please login to continue.