Rate Limiter Recipe
From a YouTube video Watch the original
Ingredients
- Middleware called "throat"
- Cache storage
- Firebase database
- Laravel application
Instructions
- Use the "throat" middleware to limit the number of requests to a specific logic to three times per 60 seconds.
- Create a cache storage to store the online users from the Firebase database and limit the number of reads to five times per minute.
- Use the "attempt" method to log the rate and reset the attempts after 60 seconds.
- Use the "available n" method to check how many seconds until the attempts are available again.
- Use the "clear" method to immediately remove the attempts.
- Implement the rate limiter for a specific logic in your Laravel application to reduce costs and comply with API restrictions.
- Support the creator by clicking one like and subscribing to their channel.
Converted from YouTube ·