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