rate-limit-redis
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -8,3 +8,4 @@ 'use strict'; | ||
expiry: 60, // default expiry is one minute | ||
prefix: "rl:" | ||
prefix: "rl:", | ||
resetExpiryOnChange: false | ||
}); | ||
@@ -19,3 +20,3 @@ | ||
// if this is new or has no expiry | ||
if (replies[0] === 1 || replies[1] === -1) { | ||
if (options.resetExpiryOnChange || replies[0] === 1 || replies[1] === -1) { | ||
// then expire it after the timeout | ||
@@ -22,0 +23,0 @@ options.client.pexpire(rdskey, expiryMs); |
{ | ||
"name": "rate-limit-redis", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Provides a Redis store for the express-rate-limit RateLimit middleware.", | ||
@@ -5,0 +5,0 @@ "main": "lib/redis-store.js", |
@@ -37,2 +37,3 @@ # Rate Limit Redis | ||
* **expiry**: seconds - how long each rate limiting window exists for. Defaults to `60`. | ||
* **resetExpiryOnChange**: boolean - if the expiry time should be reset every time a key is incremented/decremented. This means that when the limit is reached and the user is given a 429 response, the rate limit window is extended. Defaults to `false`. | ||
* **prefix**: string - prefix to add to entries in Redis. Defaults to `rl:`. | ||
@@ -39,0 +40,0 @@ * **client**: [Redis Client](https://github.com/NodeRedis/node_redis) or [ioredis Client](https://github.com/luin/ioredis)- A Redis Client to use. Defaults to `require('redis').createClient();`. |
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
11714
277
44