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.

Method of the class: VersionStringGenerator{}

No Hooks.

Returns

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

Usage

// private - for code of main (parent) class only
$result = $this->cache_entry_exists( $value, $found ): bool;
$value(mixed) (required)
The value returned by wp_cache_get().
$found(mixed) (required)
The found flag as populated by wp_cache_get(), if it populates it at all.

VersionStringGenerator::cache_entry_exists() code WC 11.1.2

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