| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Wai.RateLimit.Strategy
Synopsis
- newtype Strategy = MkStrategy {
- strategyOnRequest :: Request -> IO Bool
- fixedWindow :: Backend key -> Integer -> Integer -> (Request -> IO key) -> Strategy
- slidingWindow :: Backend key -> Integer -> Integer -> (Request -> IO key) -> Strategy
Documentation
Represents rate limiting strategies.
Constructors
| MkStrategy | |
Fields
| |
fixedWindow :: Backend key -> Integer -> 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 -> Integer -> 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.