carbond.limiter.WindowLimiterPolicy

WindowLimiterPolicy is a concrete implementation of LimiterPolicy that limits the number of requests allowed within a sliding window of time.

Class

class carbond.limiter.WindowLimiterPolicy()

extends: Limiter

window
Integer
Default 1000
Description The sliding window in milliseconds.
reqLimit
Integer
Default 1
Description The number of requests allowed within window.
allow  
Arguments
  • req (express.request) – the current Request object
  • res (express.response) – the current Response object
  • selector (String) – A string used to group similar requests
Returns true if the policy allows the request, else false
Return type Boolean
Description Overrides allow to implement windowing logic.

Example