Skip to main content

Class: RateLimitManager<K>

ratelimits/src.RateLimitManager

Type parameters

NameType
Kstring

Hierarchy

Constructors

constructor

new RateLimitManager<K>(time, limit?)

Type parameters

NameType
Kstring

Parameters

NameTypeDefault valueDescription
timenumberundefined
limitnumber1

Overrides

Map<K, RateLimit<K\>\>.constructor

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:24

Properties

[toStringTag]

Readonly [toStringTag]: string

Inherited from

Map.__@toStringTag@75363

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:135


limit

Readonly limit: number

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:13


size

Readonly size: number

Inherited from

Map.size

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:28


sweepInterval

Private sweepInterval: null | Timer

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:18


time

Readonly time: number

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:8


[species]

Static Readonly [species]: MapConstructor

Inherited from

Map.__@species@75509

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:317


sweepIntervalDuration

Static sweepIntervalDuration: number = 30_000

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:76

Methods

[iterator]

[iterator](): IterableIterator<[K, RateLimit<K>]>

Returns

IterableIterator<[K, RateLimit<K>]>

Inherited from

Map.__@iterator@75291

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:121


acquire

acquire(id): RateLimit<K>

Parameters

NameTypeDescription
idK

Returns

RateLimit<K>

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:35


clear

clear(): void

Returns

void

Inherited from

Map.clear

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:22


create

create(id): RateLimit<K>

Parameters

NameTypeDescription
idK

Returns

RateLimit<K>

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:43


delete

delete(key): boolean

Parameters

NameType
keyK

Returns

boolean

Inherited from

Map.delete

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:23


entries

entries(): IterableIterator<[K, RateLimit<K>]>

Returns

IterableIterator<[K, RateLimit<K>]>

Inherited from

Map.entries

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:126


forEach

forEach(callbackfn, thisArg?): void

Parameters

NameType
callbackfn(value: RateLimit<K>, key: K, map: Map<K, RateLimit<K>>) => void
thisArg?any

Returns

void

Inherited from

Map.forEach

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:24


get

get(key): undefined | RateLimit<K>

Parameters

NameType
keyK

Returns

undefined | RateLimit<K>

Inherited from

Map.get

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:25


has

has(key): boolean

Parameters

NameType
keyK

Returns

boolean

Inherited from

Map.has

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:26


keys

keys(): IterableIterator<K>

Returns

IterableIterator<K>

Inherited from

Map.keys

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:131


set

set(id, value): RateLimitManager<K>

Parameters

NameTypeDescription
idK
valueRateLimit<K>

Returns

RateLimitManager<K>

Overrides

Map.set

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:54


sweep

sweep(): void

Returns

void

Defined in

projects/utilities/packages/ratelimits/src/lib/RateLimitManager.ts:62


values

values(): IterableIterator<RateLimit<K>>

Returns

IterableIterator<RateLimit<K>>

Inherited from

Map.values

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:136