setExtra(key, extra)
Sets (replaces whole existing) extra in an item.
As existing extra is being entirely overwritten, be careful how / when you use it. Simply, use this method with caution.
Arguments
key
(string): Key to store the extra under (represents given item).extra
(object): Extra data to replace existing one.
Throws
If
extra
is not an object, it will throw'extra' must be an object.
Lifecycle
preSetExtra
Event name:
preSetExtra
Properties passed:cacheInstance
reference to cache instance (this
)key
key passed tosetExtra
methodextra
extra passed tosetExtra
method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpreSetExtra
eventextra
extra passed through handlers added forpreSetExtra
event
postSetExtra
Event name:
postSetExtra
Properties passed:cacheInstance
reference to cache instance (this
) returned bypreSetExtra
key
key returned bypreSetExtra
extra
extra (object) returned by adapter using its setExtra method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpostSetExtra
eventextra
extra passed through handlers added forpostSetExtra
event
Eventually
setExtra
returns extra returned bypostSetExtra
.
Example
Last updated