1.0.5 • Published 5 years ago

sr-rate-limiter v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

RATE-LIMITER

可通过此模块实现接口限流的功能

安装

npm --registry http://npm.oa.com install "sr-rate-limiter"

例子

实现按分钟进行限流,每分钟最多请求60次;

const SRRateLimiter = require('sr-rate-limiter');
SRRateLimiter.init({
  host: '127.0.0.1',
  port: 6379,
  password: '',
});
const isOk = await SRRateLimiter.acquire('use81a3341341f2341a');

init({ host, port, password })

  • host: redis的host( 必填
  • port: redis的端口号( 必填
  • password: redis的密码

acquire(appid)

  • appid: 用户的命名空间( 必填
1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago