Skip to main content

@terascope/job-components / index / BigMap

Class: BigMap<K, V>

Avoid v8 maximum size for Map by spreading the cache across multiple Maps. This class has the same API as Map but minus more differences in ->set and ->forEach

Type parameters

Type parameter
K
V

Constructors

new BigMap()

new BigMap<K, V>(entries?): BigMap<K, V>

Parameters

ParameterType
entries?null | readonly readonly [K, V][]

Returns

BigMap<K, V>

Source

packages/utils/dist/src/big-map.d.ts:15

Properties

maxMapSize

readonly maxMapSize: number

Source

packages/utils/dist/src/big-map.d.ts:11


DEFAULT_MAX_SIZE

static DEFAULT_MAX_SIZE: number

In some cache settings key evictions may not be able to keep up with the addition of new keys, setting the max size at 8.7M keys solves this issue

Source

packages/utils/dist/src/big-map.d.ts:10

Accessors

size

get size(): number

Returns

number

Source

packages/utils/dist/src/big-map.d.ts:21

Methods

[iterator]()

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

Returns

IterableIterator<[K, V]>

Source

packages/utils/dist/src/big-map.d.ts:26


clear()

clear(): void

Returns

void

Source

packages/utils/dist/src/big-map.d.ts:20


delete()

delete(key): boolean

Parameters

ParameterType
keyK

Returns

boolean

Source

packages/utils/dist/src/big-map.d.ts:19


entries()

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

Returns

IterableIterator<[K, V]>

Source

packages/utils/dist/src/big-map.d.ts:23


forEach()

forEach(callbackFn, thisArg?): void

Parameters

ParameterType
callbackFn(value, key, map) => void
thisArg?unknown

Returns

void

Source

packages/utils/dist/src/big-map.d.ts:22


get()

get(key): undefined | V

Parameters

ParameterType
keyK

Returns

undefined | V

Source

packages/utils/dist/src/big-map.d.ts:18


has()

has(key): boolean

Parameters

ParameterType
keyK

Returns

boolean

Source

packages/utils/dist/src/big-map.d.ts:17


keys()

keys(): IterableIterator<K>

Returns

IterableIterator<K>

Source

packages/utils/dist/src/big-map.d.ts:24


set()

set(key, value): Map<K, V>

Parameters

ParameterType
keyK
valueV

Returns

Map<K, V>

Source

packages/utils/dist/src/big-map.d.ts:16


values()

values(): IterableIterator<V>

Returns

IterableIterator<V>

Source

packages/utils/dist/src/big-map.d.ts:25