Automattic\WooCommerce\Internal\Api

QueryCache::is_opcache_usableprivateWC 1.0

Whether the OPcache file backend can be used for this request.

Memoised per request: the underlying checks (opcache_get_status, filesystem writability) don't change mid-request and are wasteful to repeat across the read and write paths.

Method of the class: QueryCache{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->is_opcache_usable(): bool;

QueryCache::is_opcache_usable() code WC 10.9.1

private function is_opcache_usable(): bool {
	if ( null !== $this->opcache_usable ) {
		return $this->opcache_usable;
	}

	$this->opcache_usable = $this->compute_is_opcache_usable();
	return $this->opcache_usable;
}