Get access to a rate limiter for your Edge-first application.
The RateLimit object gives you an limit method you can call with any key
to identify the thing you want to rate limit.
The default limit is set to 10, the default period is set to 60s, this means
by default any call to limit will allow 10 calls in a limit of 60s
There's also a reset method that will delete the rate limit for a given
key.
The writeHttpMetadata method will fill a Headers object with the necessary
headers to inform the client about the rate limit. If a Headers object is not
provided, a new one will be created and returned.
Get access to a rate limiter for your Edge-first application.
The RateLimit object gives you an
limit
method you can call with any key to identify the thing you want to rate limit.The default limit is set to 10, the default period is set to 60s, this means by default any call to
limit
will allow 10 calls in a limit of 60sThere's also a
reset
method that will delete the rate limit for a given key.The
writeHttpMetadata
method will fill a Headers object with the necessary headers to inform the client about the rate limit. If a Headers object is not provided, a new one will be created and returned.