https://github.com/previousdeveloper/global-ratelimit
Distributed rate limiter, using Redis.
https://github.com/previousdeveloper/global-ratelimit
Last synced: 2 months ago
JSON representation
Distributed rate limiter, using Redis.
- Host: GitHub
- URL: https://github.com/previousdeveloper/global-ratelimit
- Owner: previousdeveloper
- Created: 2021-04-27T10:12:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-27T10:16:06.000Z (about 4 years ago)
- Last Synced: 2024-12-29T06:30:02.375Z (4 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# global-ratelimit
Distributed rate limiter, using Redis.This package allows us to have a distributed rate limiter, using Redis or Couchbase as a central counter.
We can use it for sidecar model. Now rate limiter supports two rate limit algorithm which are token based and window rate.
## How it works
```yaml
rate_limits:
- actions:
endpoint: '/product-recommendation/:id/*'
method: GET
keys: "id"
requests_per_unit: 1
unit: minute
header_key: "test"
- actions:
endpoint: '/product-recommendation/*'
method: POST
from: "body"
body_keys: "supplierId"
requests_per_unit: 5
unit: hour
```You create config decleration, by specifying a limit and an interval. For example, maybe you want limit by using path variable or query string variable.