Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

923
Views
Cómo configurar el limitador de velocidad por segundo en Laravel versión 8

Cómo configurar el limitador de velocidad por segundo en Laravel 8 . Necesito configurar el limitador de velocidad por segundo en lugar de por minuto.

Limitador de velocidad (Laravel 8) - https://laravel.com/docs/8.x/routing#rate-limiting

En este momento, puedo usar el limitador de velocidad de Laravel durante minutos, horas, etc. Pero estoy tratando de lograr un limitador de velocidad por un segundo. Quiero limitar 25 solicitudes por segundo. (Clase de límite exportada de "Illuminate\Cache\RateLimiting\Limit")

Por favor revise el siguiente código que he usado

 RateLimiter::for('api', function (Request $request) { return [ // Rate limiter based on Client IP Address Limit::perMinute(env('IP_ADDR_RATE_LIMITER_PER_MINUTE', 60))->by($request->ip())->response(function () { .... }), // Rate limiter based on API key/User Limit::perMinute(env('API_KEY_RATE_LIMITER_PER_MINUTE', 60))->by($request->input('key'))->response(function () { ... }) ]; });

¿Hay alguna forma de limitar la tasa de 25 solicitudes por segundo?

Nota: también intenté agregar/cambiar funciones en Illuminate\Cache\RateLimiting\Limit, donde intenté alterar la función por minuto. Gracias de antemano.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede redefinir la clase \Illuminate\Cache\RateLimiting\Limit para permitir el atributo $perSeconds de tipo flotante y agregar una nueva función perSeconds().

 /** * Create a new rate limit using seconds as decay time. * * @param int $maxAttempts * @param int $decaySeconds * @return static */ public static function perSeconds($decaySeconds, $maxAttempts) { return new static('', $maxAttempts, $decaySeconds/60.0); }
over 4 years ago · Santiago Trujillo Report

0

Es posible configurar Laravel 8 RateLimitter para permitir req/segundos

Aquí está el ejemplo que está buscando: https://learn2torials.com/thread/how-to-set-the-rate-limiter-for-per-second-in-laravel-version-8

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!