buildKey(key)

Last updated 5 months ago

Builds a key.

Arguments

  1. key (string): String to build a key of.

Lifecycle

  1. preBuildKey

    Event name: preBuiltKey Properties passed:

    • cacheInstance reference to cache instance (this)

    • key key passed to buildKey method

    Returns: (object): object containing properties:

    • cacheInstance reference to cache instance (this)

    • key key passed through handlers added for preBuildKey event

  2. postBuildKey

    Event name: postBuiltKey Properties passed:

    • cacheInstance reference to cache instance (this) returned by preBuildKey

    • key key built by adapter using its buildKey method

    Returns: (object): object containing properties:

    • cacheInstance reference to cache instance (this)

    • key key passed through handlers added for postBuildKey event

    Eventually buildKey returns key returned by postBuildKey.

Returns

(string): Built key. Depends on adapter being used.

Example

// assuming that you already have cache instance prepared
const builtKey = cache.buildKey('key');