Helper functions for managing generic cache.

Methods

(async, static) clear(optsopt) → {Promise.<void>}

Clear cached items from the store.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for clearing the cache

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached item to clear

Returns:
Type: 
Promise.<void>

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

Get a cached item from the store.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for retrieving the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached item

Returns:
  • Returns the cached item or false if not found
Type: 
Promise.<*>

(async, static) remove(optsopt) → {Promise.<void>}

Remove a cached item from the store.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for removing the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached item to remove

Returns:
Type: 
Promise.<void>

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

Set a cached item in the store.

Parameters:
NameTypeAttributesDefaultDescription
optsobject<optional>
{}

The options for setting the cached item

Properties
NameTypeAttributesDescription
keystring<optional>

The key of the cached item

value*<optional>

The value of the cached item

ttlnumber<optional>

The time-to-live for the cached item

Returns:
Type: 
Promise.<void>