@zcong/redis-ratelimiter
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

redis-ratelimiter

NPM version NPM downloads CircleCI codecov donate

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

  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, Released under the MIT License.
Authored and maintained by zcong1993 with help from contributors (list).

github.com/zcong1993 · GitHub @zcong1993

/@zcong/redis-ratelimiter/

    Package Sidebar

    Install

    npm i @zcong/redis-ratelimiter

    Weekly Downloads

    0

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    4.37 kB

    Total Files

    5

    Last publish

    Collaborators

    • zcong