time(), 'count' => 1], $window_seconds); return true; } $start = (int) ($data['start'] ?? 0); $count = (int) ($data['count'] ?? 0); if ((time() - $start) > $window_seconds) { set_transient($key, ['start' => time(), 'count' => 1], $window_seconds); return true; } if ($count >= $limit) { return false; } $data['count'] = $count + 1; set_transient($key, $data, $window_seconds); return true; } }