Provider::hydrate_cache_on_occurrence( mixed $value, int $object_id, string $meta_key, bool $single )

Hydrate the cache when a meta key is requested individually, if data is already on the cache avoid processing.


Parameters

$value

(mixed) (Required) The value to return, either a single metadata value or an array of values depending on the value of $single. Default null.

$object_id

(int) (Required) ID of the object metadata is for.

$meta_key

(string) (Required) Metadata key.

$single

(bool) (Required) Whether to return only the first value of the specified $meta_key.


Top ↑

Source

File: src/Events_Pro/Custom_Tables/V1/WP_Query/Provider.php

	public function hydrate_cache_on_occurrence( $value, $object_id, $meta_key, $single ) {
		if ( $this->noop ) {
			return $value;
		}

		$provisional_post = $this->container->make( Provisional_Post::class );
		// The requested element is not an occurrence move on.
		if ( ! $provisional_post->is_provisional_post_id( $object_id ) ) {
			return $value;
		}

		$cache = wp_cache_get( $object_id, 'post_meta' );
		// This is already on the post_meta cache move on.
		if ( false !== $cache ) {
			return $value;
		}

		$provisional_post->hydrate_caches( [ $object_id ] );

		return $value;
	}

Top ↑

Changelog

Changelog
Version Description
6.0.0 Introduced.