Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/redis-ratelimiter
ratelimiter by redis
https://github.com/zcong1993/redis-ratelimiter
Last synced: 1 day ago
JSON representation
ratelimiter by redis
- Host: GitHub
- URL: https://github.com/zcong1993/redis-ratelimiter
- Owner: zcong1993
- License: mit
- Created: 2018-07-10T04:38:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-10T04:57:51.000Z (over 6 years ago)
- Last Synced: 2024-10-12T23:44:54.676Z (26 days ago)
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redis-ratelimiter
[![NPM version](https://img.shields.io/npm/v/@zcong/redis-ratelimiter.svg?style=flat)](https://npmjs.com/package/@zcong/redis-ratelimiter) [![NPM downloads](https://img.shields.io/npm/dm/@zcong/redis-ratelimiter.svg?style=flat)](https://npmjs.com/package/@zcong/redis-ratelimiter) [![CircleCI](https://circleci.com/gh/zcong1993/redis-ratelimiter/tree/master.svg?style=shield)](https://circleci.com/gh/zcong1993/redis-ratelimiter/tree/master) [![codecov](https://codecov.io/gh/zcong1993/redis-ratelimiter/branch/master/graph/badge.svg)](https://codecov.io/gh/zcong1993/redis-ratelimiter)
[![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/zcong1993/donate)## Install
```bash
$ yarn add @zcong/redis-ratelimiter
```## Usage
```js
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
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## Author
**redis-ratelimiter** © [zcong1993](https://github.com/zcong1993), Released under the [MIT](./LICENSE) License.
Authored and maintained by zcong1993 with help from contributors ([list](https://github.com/zcong1993/redis-ratelimiter/contributors)).> [github.com/zcong1993](https://github.com/zcong1993) · GitHub [@zcong1993](https://github.com/zcong1993)