load(); \support\App::loadAllConfig(['route']); if (!preg_match('/^mini-protection-test:[a-f0-9]{24}:concurrent$/D', $argv[1] ?? '')) { throw new RuntimeException('Expected isolated test key'); } $accepted = 0; for ($i = 0; $i < 20; $i++) { $result = (new \app\miniapi\protection\RedisQuota())->consume([ ['key' => $argv[1], 'limit' => 35, 'seconds' => 60, 'cost' => 1, 'rule' => 'concurrent'], ]); if ($result[0] === 0) { $accepted++; } } echo $accepted;