@zcong/redis-ratelimiter
v0.1.2
Published
ratelimitor by redis
Downloads
4
Readme
redis-ratelimiter
Install
$ yarn add @zcong/redis-ratelimiter
Usage
const Ratelimiter = require('@zcong/redis-ratelimiter')
const rlt = new Ratelimiter({
redisUrl: process.env.REDIS_URL,
rate: 2,
unit: 1
})
const run = async () => {
const key = 'test_key'
console.log(await rlt.payload(key)) // false
console.log(await rlt.payload(key, 2)) // true
}
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
redis-ratelimiter © zcong1993, Released under the MIT License. Authored and maintained by zcong1993 with help from contributors (list).
github.com/zcong1993 · GitHub @zcong1993