Automattic\WooCommerce\Internal\Caches

VersionStringGenerator::cache_entry_exists │ private │ WC 1.0

Tell whether a value read from the cache is evidence that an entry is stored.

Object cache drop-ins replace wp_cache_get() wholesale, so neither the returned value nor the found flag is trustworthy on its own: some drop-ins never populate $found, and some signal a miss with null rather than false. The value is therefore the primary evidence, with $found as a tie-breaker that tells a stored false apart from a genuine miss. $found is checked loosely because a drop-in may report it as a truthy non-boolean.

Метод класса: VersionStringGenerator{}

Хуков нет.

Возвращает

bool. True if an entry appears to be stored, false if this looks like a miss.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->cache_entry_exists( $value, $found ): bool;
$value(разное) (обязательный)
The value returned by wp_cache_get().
$found(разное) (обязательный)
The found flag as populated by wp_cache_get(), if it populates it at all.

Код VersionStringGenerator::cache_entry_exists() WC 11.2.2

private function cache_entry_exists( $value, $found ): bool {
	return (bool) $found || ( false !== $value && null !== $value );
}