Class: Cache

Cache(capacity)

A Cache object represents a cache of arbitrary data.

Constructor

new Cache(capacity)

Creates a cache.
Parameters:
Name Type Description
capacity number The maximum number of entries that can exist in the cache.
Source:

Methods

clear()

Clears the cache.
Source:

get(keynullable) → (nullable) {*}

Reads an entry from the cache.
Parameters:
Name Type Attributes Description
key * <nullable>
The key for the entry.
Source:
Returns:
The value of the entry, or undefined if the entry doesn't exist in the cache.
Type
*

set(keynullable, valuenullable)

Writes an entry to the cache. If the cache has reached the specified maximum number of entries, all the old entries are cleared first.
Parameters:
Name Type Attributes Description
key * <nullable>
The key for the entry.
value * <nullable>
The value of the entry.
Source: