ktor-rate-limiting
1.3.3
ktor-rate-limiting
/
dev.forst.ktor.ratelimiting
/
LinearRateLimiter
Linear
Rate
Limiter
class
LinearRateLimiter
(
limitersSettings
:
Map
<
UUID
,
Pair
<
Long
,
Duration
>
>
,
purgeHitSize
:
Int
,
purgeHitDuration
:
Duration
,
nowProvider
:
(
)
->
Instant
,
initialSize
:
Int
)
Content copied to clipboard
Linear implementation of the rate limiting.
Constructors
Functions
Sources
Constructors
Linear
Rate
Limiter
Link copied to clipboard
fun
LinearRateLimiter
(
limitersSettings
:
Map
<
UUID
,
Pair
<
Long
,
Duration
>
>
,
purgeHitSize
:
Int
=
DEFAULT_PURGE_HIT_SIZE
,
purgeHitDuration
:
Duration
=
DEFAULT_PURGE_HIT_DURATION
,
nowProvider
:
(
)
->
Instant
=
{ Instant.now() }
,
initialSize
:
Int
=
DEFAULT_INITIAL_CACHE_SIZE
)
Content copied to clipboard
Functions
process
Request
Link copied to clipboard
fun
processRequest
(
limitId
:
UUID
,
key
:
String
)
:
Long
?
Content copied to clipboard
Logs request attempt from the
key
with limiter
limitId
.
Sources
Ktor Rate Limiting source
Link copied to clipboard