public function asset($path, $secure = null)
As you can see from GitHub the
asset method is calling
getScheme to determine what the scheme should be.
So if you don't provide the
asset 2nd parameter
$secure then it uses the request scheme. Otherwise you can provide
$secure to force the desired scheme regardless of what is the scheme in the request.
If you look at the code you'll see that if
$secure is null and no cache is set than the cache is set to the request scheme (i.e.
$this->request->getScheme()) and therefore returned.