wai-rate-limit-0.3.0.0: Rate limiting as WAI middleware
Safe HaskellNone
LanguageHaskell2010

Network.Wai.RateLimit.Strategy

Description

Exports functions which implement rate-limiting strategies.

Synopsis

Documentation

newtype Strategy Source #

Represents rate limiting strategies.

Constructors

MkStrategy 

Fields

fixedWindow :: Backend key -> Second -> Integer -> (Request -> IO key) -> Strategy Source #

fixedWindow seconds limit is a Strategy which limits the number of requests made by a client to limit within a window of seconds.

slidingWindow :: Backend key -> Second -> Integer -> (Request -> IO key) -> Strategy Source #

slidingWindow seconds limit is a Strategy which limits the number of requests made by a client to limit within a sliding window of seconds. That is, for every successful request, the window is extended by seconds so that a "break" of seconds is required after limit-many requests have been made in a period during which the timeout has never been exceeded.