Class: RateLimit

RateLimit(keyopt, cacheObjopt)

Simple class that keeps track of a time. When run is called, a when is passed indicating how much time to wait after that call before calling the passed in func again.

Constructor

new RateLimit(keyopt, cacheObjopt)

Initializes the delay to the past so the first call immediately runs
Parameters:
Name Type Attributes Description
key string <optional>
key for the backing map in the cache
cacheObj object <optional>
cache object to use (defaults to cache.private if key is provided)
Source:

Methods

run(func)

Parameters:
Name Type Description
func function action to run if it's been long enough
Source: