Skip to main content

resetKey(key)

Resets the rate limiting for a given key. An example use case is to allow users to complete a captcha to reset their rate limit, then call this function. Example:
The default keyGenerator stores IPv6 clients under their subnet rather than their full address, so resetKey(req.ip) would not match their key. Passing the IP through ipKeyGenerator produces the same key the limiter uses (pass your ipv6Subnet as the second argument if you changed it). If you use a custom keyGenerator, pass the key it returns instead.

getKey(key)

Retrieves the hit count and reset time from the store for a given key. Note: getKey depends on store support. It works with the MemoryStore and cluster-memory-store, but may not work with other stores. Calling it will throw an error if the store does not have a get method.