JSCache

JSCache

The JSCache can be used by to share information between subsequent runs of the same script or between scripts (depending on implementation).

Methods

exists(key) → {boolean}

Description:
  • Checks the mapping for a key from this map.

Source:
Parameters:
Name Type Description
key string

key whose mapping is to be checked in the map

Returns:

whether the key has a mapping

Type
boolean

get(key, defaultSupplieropt, jsifyResultopt) → {*|null}

Description:
  • Returns the value to which the specified key is mapped.

Source:
Parameters:
Name Type Attributes Default Description
key string

the key whose associated value is to be returned

defaultSupplier function <optional>

if the specified key is not already associated with a value, this function will return a default value. The output of the function will be run through javaify() if the cache is shared, since the shared cache can't contain JavaScript objects.

jsifyResult boolean <optional>
true

whether or not the result will be automatically converted to JavaScript objects when possible

Returns:

the current object for the supplied key, the value returned by defaultSupplier (if provided), or null

Type
* | null

put(key, value, jsifyResultopt) → {*|null}

Description:
  • Associates the specified value with the specified key.

Source:
Parameters:
Name Type Attributes Default Description
key string

key with which the specified value is to be associated

value *

value to be associated with the specified key. The value will be run through javaify() if the cache is shared, since the shared cache can't contain JavaScript objects.

jsifyResult boolean <optional>
true

whether or not the result will be automatically converted to JavaScript objects when possible

Returns:

the previous value associated with the key, or null if there was no mapping for key

Type
* | null

remove(key, jsifyResultopt) → {*|null}

Description:
  • Removes the mapping for a key from this map if it is present.

Source:
Parameters:
Name Type Attributes Default Description
key string

key whose mapping is to be removed from the cache

jsifyResult boolean <optional>
true

whether or not the result will be automatically converted to JavaScript objects when possible

Returns:

the previous value associated with the key or null if there was no mapping for key

Type
* | null