hasItem(key)
Checks if item exists.
Arguments
key(string): Key to check if an item exists by.
Lifecycle
preHasItem
Event name:
preHasItemProperties passed:cacheInstancereference to cache instance (this)keykey passed tohasItemmethod
Returns: (object): object containing properties:
cacheInstancereference to cache instance (this)keykey passed through handlers added forpreHasItemevent
postHasItem
Event name:
postHasItemProperties passed:cacheInstancereference to cache instance (this) returned bypreHasItemkeykey returned bypreHasItemresultboolean value returned by adapter using its hasItem method
Returns: (object): object containing properties:
cacheInstancereference to cache instance (this)keykey passed through handlers added forpostHasItemeventresultboolean value passed through handlers added forpostHasItemevent
Eventually
hasItemreturns result returned bypostHasItem.
Returns
(bool): true if item exists, false otherwise.
Example
// assuming that you already have cache instance prepared
cache.hasItem('key'); // true
cache.hasItem('keyForItemThatDoesNotExist'); // falseLast updated