CachingIterator::offsetExists

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

CachingIterator::offsetExists — Check whether an element exists in the cache

Description

public function CachingIterator::offsetExists(string $key): bool

Checks whether an element is stored under key in the cache. This method is called when isset() or empty() is used on the CachingIterator with array syntax, such as isset($iterator['key']).

The CachingIterator::FULL_CACHE flag must be set.

Parameters

key

The key being checked.

Return Values

Returns true if an element is stored under key in the cache, false otherwise.

Errors/Exceptions

Throws a BadMethodCallException if the CachingIterator::FULL_CACHE flag is not set.

See Also