Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimeoutMap<K, V>

Map with set validity period

Type parameters

  • K

  • V

Hierarchy

  • Map<K, V>
    • TimeoutMap

Index

Constructors

constructor

  • new TimeoutMap<K, V>(entries?: null | readonly readonly [K, V][], options?: TimeoutMapOptions<K, V>): TimeoutMap<K, V>
  • Type parameters

    • K

    • V

    Parameters

    • Optional entries: null | readonly readonly [K, V][]
    • Optional options: TimeoutMapOptions<K, V>

    Returns TimeoutMap<K, V>

Properties

Readonly [Symbol.toStringTag]

[Symbol.toStringTag]: string

Private Readonly _keyArgs

_keyArgs: Map<K, TimeoutMapKeyArgs<K, V>> = ...

Private Readonly _options

_options: TimeoutMapOptions<K, V> = {}

Readonly size

size: number

Static Readonly [Symbol.species]

[Symbol.species]: MapConstructor

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<[K, V]>
  • Returns an iterable of entries in the map.

    Returns IterableIterator<[K, V]>

Private _cleanExpirationElement

  • _cleanExpirationElement(): void

Private _cleanOverLimitElement

  • _cleanOverLimitElement(): void

Private _clearTimeout

  • _clearTimeout(key: K): boolean

Private _mergeOptions

  • _mergeOptions(options?: Partial<TimeoutMapOptions<K, V>>): TimeoutMapOptions<K, V>

Private _setKeyArgs

  • _setKeyArgs(k: K, args: Partial<TimeoutMapKeyArgs<K, V>>): TimeoutMapKeyArgs<K, V>

Private _setTimeout

  • _setTimeout(key: K, options?: TimeoutMapOptions<K, V>): void

clear

  • clear(): void

delete

  • delete(key: any): boolean

entries

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

forEach

  • forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void
  • Parameters

    • callbackfn: (value: V, key: K, map: Map<K, V>) => void
        • (value: V, key: K, map: Map<K, V>): void
        • Parameters

          • value: V
          • key: K
          • map: Map<K, V>

          Returns void

    • Optional thisArg: any

    Returns void

get

  • get(key: K): undefined | V

has

  • has(key: K): boolean

keys

  • keys(): IterableIterator<K>

set

  • set(key: K, value: V, options?: Omit<TimeoutMapOptions<K, V>, keyof TimeoutMapConstructorOptions>): TimeoutMap<K, V>
  • Parameters

    • key: K
    • value: V
    • Optional options: Omit<TimeoutMapOptions<K, V>, keyof TimeoutMapConstructorOptions>

    Returns TimeoutMap<K, V>

values

  • values(): IterableIterator<V>