rate-limit-redis
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -22,2 +22,5 @@ 'use strict'; | ||
options.client.pexpire(rdskey, expiryMs); | ||
return expiryMs; | ||
} else { | ||
return replies[1]; | ||
} | ||
@@ -51,5 +54,5 @@ }; | ||
replies = processReplies(replies); | ||
setExpire(replies, rdskey); | ||
var ttl = setExpire(replies, rdskey); | ||
cb(null, replies[0]); | ||
cb(null, replies[0], ttl > 0 ? new Date(new Date().getTime() + ttl) : null); | ||
}); | ||
@@ -56,0 +59,0 @@ }; |
{ | ||
"name": "rate-limit-redis", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Provides a Redis store for the express-rate-limit RateLimit middleware.", | ||
@@ -5,0 +5,0 @@ "main": "lib/redis-store.js", |
@@ -34,2 +34,18 @@ # Rate Limit Redis | ||
## Connect to UDP Socket | ||
``` | ||
var RateLimit = require('express-rate-limit'); | ||
var RedisStore = require('rate-limit-redis'); | ||
var Redis = require('ioredis'); | ||
var client = new Redis('/tmp/redis.sock'); | ||
var limiter = new RateLimit({ | ||
store: new RedisStore({ | ||
client: client, | ||
}), | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
delayMs: 0 // disable delaying - full speed until the max limit is reached | ||
}); | ||
``` | ||
## Configuration | ||
@@ -36,0 +52,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12395
8
280
60