Preparing search index...
The search index is not available
libp2p
libp2p
@libp2p/utils
rate-limiter
RateLimiter
Class RateLimiter
Index
Constructors
constructor
Properties
block
Duration
duration
exec
Evenly
exec
Evenly
Min
Delay
Ms
key
Prefix
memory
Storage
points
Methods
_get
Key
Sec
Duration
block
consume
delete
get
get
Key
parse
Key
penalty
reward
set
Constructors
constructor
new
Rate
Limiter
(
opts
?
)
:
RateLimiter
Parameters
opts
:
RateLimiterInit
= {}
Returns
RateLimiter
Properties
Protected
block
Duration
block
Duration
:
number
Protected
duration
duration
:
number
Protected
exec
Evenly
exec
Evenly
:
boolean
Protected
exec
Evenly
Min
Delay
Ms
exec
Evenly
Min
Delay
Ms
:
number
Protected
key
Prefix
key
Prefix
:
string
Readonly
memory
Storage
memory
Storage
:
MemoryStorage
Protected
points
points
:
number
Methods
Private
_get
Key
Sec
Duration
_get
Key
Sec
Duration
(
options
?
)
:
number
Parameters
Optional
options
:
GetKeySecDurationOptions
Returns
number
block
block
(
key
,
secDuration
)
:
RateLimiterResult
Block any key for secDuration seconds
Parameters
key
:
string
secDuration
:
number
Returns
RateLimiterResult
consume
consume
(
key
,
pointsToConsume
?
,
options
?
)
:
Promise
<
RateLimiterResult
>
Parameters
key
:
string
pointsToConsume
:
number
= 1
options
:
GetKeySecDurationOptions
= {}
Returns
Promise
<
RateLimiterResult
>
delete
delete
(
key
)
:
void
Parameters
key
:
string
Returns
void
get
get
(
key
)
:
undefined
|
RateLimiterResult
Parameters
key
:
string
Returns
undefined
|
RateLimiterResult
get
Key
get
Key
(
key
)
:
string
Parameters
key
:
string
Returns
string
parse
Key
parse
Key
(
rlKey
)
:
string
Parameters
rlKey
:
string
Returns
string
penalty
penalty
(
key
,
points
?
,
options
?
)
:
RateLimiterResult
Parameters
key
:
string
points
:
number
= 1
options
:
GetKeySecDurationOptions
= {}
Returns
RateLimiterResult
reward
reward
(
key
,
points
?
,
options
?
)
:
RateLimiterResult
Parameters
key
:
string
points
:
number
= 1
options
:
GetKeySecDurationOptions
= {}
Returns
RateLimiterResult
set
set
(
key
,
points
,
secDuration
?
)
:
RateLimiterResult
Parameters
key
:
string
points
:
number
secDuration
:
number
= 0
Returns
RateLimiterResult
Settings
Member Visibility
Protected
Private
Inherited
External
Theme
OS
Light
Dark
On This Page
constructor
block
Duration
duration
exec
Evenly
exec
Evenly
Min
Delay
Ms
key
Prefix
memory
Storage
points
_get
Key
Sec
Duration
block
consume
delete
get
get
Key
parse
Key
penalty
reward
set
libp2p
Loading...
Block any key for secDuration seconds