ratelimit-lru
Small module for doing generic rate limiting using an LRU cache
npm install ratelimit-lru
Usage
var http =var ratelimit =var ratelimited =var server = http// try accessing this a bunch of times in your browserserver
API
var ratelimited = ratelimit([opts])
Returns a function that tells you if a current key (usually an IP string) is being ratelimited.
Options include:
cache: 1000 // how big the cache should belimit: 5 // how many times per second this function can be called
var bool = ratelimited(key)
Returns true
if the key is being ratelimited, otherwise false.
License
MIT