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.
Returns
(bool): true if item was removed, false otherwise.
Example
// assuming that you already have cache instance prepared
cache.removeItem('key'); // true
cache.removeItem('keyForItemThatDoesNotExist'); // falseLast updated