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 currentRequest
object - res (
express.response
) – the currentResponse
object - selector (
String
) – A string used to group similar requests
Returns true
if the policy allows the request, elsefalse
Return type Boolean
Description Overrides allow
to implement windowing logic.- req (