hasItem(key)
Checks if item exists.
Arguments
key
(string): Key to check if an item exists by.
Lifecycle
preHasItem
Event name:
preHasItem
Properties passed:cacheInstance
reference to cache instance (this
)key
key passed tohasItem
method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpreHasItem
event
postHasItem
Event name:
postHasItem
Properties passed:cacheInstance
reference to cache instance (this
) returned bypreHasItem
key
key returned bypreHasItem
result
boolean value returned by adapter using its hasItem method
Returns: (object): object containing properties:
cacheInstance
reference to cache instance (this
)key
key passed through handlers added forpostHasItem
eventresult
boolean value passed through handlers added forpostHasItem
event
Eventually
hasItem
returns result returned bypostHasItem
.
Even though hasItem
uses buildKey
internally, that build key is not passed in postHasItem
event handler's object's properties. If key is somehow changed (with some plugin) during preBuildKey
or postGetKey
event handlers, that key is not passed further in hasItem
. If you need access to built key, you can still obtain it from returned item to which you have access in postHasItem
.
Returns
(bool): true
if item exists, false
otherwise.
Example
Last updated