yii\redis\ActiveQuery::count PHP Method

count() public method

Returns the number of records.
public count ( string $q = '*', Connection $db = null ) : integer
$q string the COUNT expression. This parameter is ignored by this implementation.
$db Connection the database connection used to execute the query. If this parameter is not given, the `db` application component will be used.
return integer number of records
    public function count($q = '*', $db = null)
    {
        if ($this->where === null) {
            /* @var $modelClass ActiveRecord */
            $modelClass = $this->modelClass;
            if ($db === null) {
                $db = $modelClass::getDb();
            }
            return $db->executeCommand('LLEN', [$modelClass::keyPrefix()]);
        } else {
            return $this->executeScript($db, 'Count');
        }
    }