Skip to main content
Version: 3.28.0

RateCounter.prototype.lookupRate

Look up the current rate for the given entry and the given window.

Syntax

lookupRate(entry, window)

Parameters

  • entry : string
    • The name of the entry to look up
  • window : number
    • The window to look up alongside the entry, has to be either 1 second, 10 seconds, or 60 seconds

Return value

Returns a number which is the rate for the given entry and window in this RateCounter instance.

Exceptions

  • TypeError
    • Thrown if the provided entry value can not be coerced into a string
    • Thrown if the provided window value is not either, 1, 10, or 60.