Skip to content

matteo-pampana/go-redis-rate-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Redis Rate Limiter

This repository contains a Golang's implementation of a rate limiter based on a Redis DB.

This implementation is based on the Redis Best Practices for rate limiting explained here.

Run the example

To run the example you must have docker installed on your machine.

Then, go to the example folder and run:

docker-compose up

Docker compose will spin up a redis instance and a gin-based webserver.

Go to your favorite browser, or do a cURL (or open postman, whatever you like) at the following URL:

http://localhost:8081/rate-limiter?name=<name>

The rate limiter is based on the name query param. You can call it with the same name for 10 times, then you have to wait 1 minute to call the endpoint again.


Made with ❤️   by Matteo Pampana

About

A Golang's implementation of a rate limiter based on Redis

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages