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

Network.Wai.RateLimit.Backend

Synopsis

Documentation

data BackendError Source #

Represents a base type for exceptions that occur in Backends.

Constructors

forall e.Exception e => BackendError e 

data Backend key Source #

Represents storage backends for the rate limiting middleware.

Constructors

MkBackend 

Fields

  • backendGetUsage :: key -> IO Integer

    backendGetUsage key is a computation which gets the usage associated with key. This computation may raise a BackendError exception if an error occurs while trying to retrieve the key's usage from the backend.

  • backendIncAndGetUsage :: key -> Integer -> IO Integer

    backendIncAndGetUsage key usage is a computation which increments the usage associated with key by usage and returns the result. This computation may raise a BaackendError exception if an error occurs while trying to increment and retrieve the usage associated with key.

  • backendExpireIn :: key -> Integer -> IO ()

    backendExpireIn key seconds is a computation which makes key expire in seconds from now. This computation may raise a BackendError exception if an error occurs while trying to set key to expire.