Helper functions for managing function cache.

Methods

(async, static) clear(optsopt)

Clear all cached function items.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for clearing the cache

(async, static) get(optsopt) → {Promise.<*>}

Get a cached function item by key.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for retrieving the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached function item

Returns:
  • Returns the cached function item or undefined if expired/not found
Type: 
Promise.<*>

(async, static) remove(optsopt)

Remove a cached function item by key.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for removing the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached function item

(async, static) set(optsopt) → {Promise.<boolean>}

Set a cached function item.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for setting the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached function item

value*<optional>

The value of the cached function item

ttlnumber<optional>

The time-to-live for the cached function item

Returns:
  • Returns true if the item was successfully cached
Type: 
Promise.<boolean>