removeItem(key)
Removes an item.
Arguments
key(string): Key to remove an item by.
Lifecycle
preRemoveItem
Event name:
preRemoveItemProperties passed:cacheInstancereference to cache instance (this)keykey passed toremoveItemmethod
Returns: (object): object containing properties:
cacheInstancereference to cache instance (this)keykey passed through handlers added forpreRemoveItemevent
postRemoveItem
Event name:
postRemoveItemProperties passed:cacheInstancereference to cache instance (this) returned bypreRemoveItemkeykey returned bypreRemoveItemresultboolean value returned by adapter using its removeItem method
Returns: (object): object containing properties:
cacheInstancereference to cache instance (this)keykey passed through handlers added forpostRemoveItemeventresultboolean value passed through handlers added forpostRemoveItemevent
Eventually
removeItemreturns 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