Class: TimeoutMap

TimeoutMap


new TimeoutMap(timeout [, refreshRate])

Parameters:
Name Type Argument Description
timeout number
refreshRate number <optional>

Methods


delete(key)

Remove the specified value from the set.

Parameters:
Name Type Description
key K
Returns:
Type
boolean

get(key)

Return the value associated to the specified key, if still present in the map.

Parameters:
Name Type Description
key K
Returns:
Type
V | undefined

getSize()

Return the current size of the map

Returns:
Type
number

has(key)

Return whether the specified key is already in the map

Parameters:
Name Type Description
key K
Returns:
Type
boolean

onEmpty(handler)

Define a function to call every time the map becomes empty

Parameters:
Name Type Description
handler function
Returns:

this

Type
olympe.utils.TimeoutMap

onTimeout(handler)

Define a function to call when a value reached the timeout.

Parameters:
Name Type Description
handler function
Returns:

this

Type
olympe.utils.TimeoutMap

refresh(key)

Refresh the timeout of the specified key. Return true if the value was there and so refreshed.

Parameters:
Name Type Description
key K
Returns:
Type
boolean

set(key, value)

Insert the specified key-value pair in the map.

Parameters:
Name Type Description
key K
value V