getExtra(key)

Returns extra (for given object for given key).

Arguments

  1. key (string): Key to get an extra by.

Lifecycle

  1. preGetExtra

    Event name: preGetExtra Properties passed:

    • cacheInstance reference to cache instance (this)

    • key key passed to getExtra method

    Returns: (object): object containing properties:

    • cacheInstance reference to cache instance (this)

    • key key passed through handlers added for preGetExtra event

  2. postGetExtra

    Event name: postGetExtra Properties passed:

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

    • key key returned by preGetExtra

    • extra extra (object) returned by adapter using its getExtra method

    Returns: (object): object containing properties:

    • cacheInstance reference to cache instance (this)

    • key key passed through handlers added for postGetExtra event

    • extra extra passed through handlers added for postGetExtra event

    Eventually getExtra returns extra returned by postGetExtra.

Returns

(object): Object, extra from item.

(undefined): If item is not found (thus no extra can be taken from it), returns undefined.

Example

// assuming that you already have cache instance prepared
cache.getExtra('key'); // object, extra for that item
cache.getExtra('keyForItemThatDoesNotExist'); // undefined

Last updated