removeItem(key)
Removes an item.
Arguments
key
(string): Key to remove an item by.
Lifecycle
preRemoveItem
Event name:
preRemoveItem
Properties passed:cacheInstance
reference to cache instance (this
)key
key passed toremoveItem
method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpreRemoveItem
event
postRemoveItem
Event name:
postRemoveItem
Properties passed:cacheInstance
reference to cache instance (this
) returned bypreRemoveItem
key
key returned bypreRemoveItem
result
boolean value returned by adapter using its removeItem method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpostRemoveItem
eventresult
boolean value passed through handlers added forpostRemoveItem
event
Eventually
removeItem
returns result returned bypostRemoveItem
.
Even though removeItem
uses buildKey
internally, that build key is not passed in postRemoveItem
event handler's object's properties. If key is somehow changed (with some plugin) during preBuildKey
or postGetKey
events, that key is not passed further in removeItem
. If you need access to built key, you can still obtain it from returned item to which you have access in postRemoveItem
.
Returns
(bool): true
if item was removed, false
otherwise.
Example
Last updated